# OfficeImageExportResult

Result returned by dependency-free image export operations.

Class 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[OfficeImageExportResult.cs:31](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L31)

**Modifiers**

sealed

Result returned by dependency-free image export operations.

## Inheritance

- object
- OfficeImageExportResult

## Usage

Explore 12 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 6

- Method [OfficeDrawing.ToImage](/api/core/officeimo-drawing-officedrawing/#method-toimage-officeimo-drawing-officeimageexportformat-officeimo-drawing-officeimageexportoptions-threading-cancellationtoken)
- Method [OfficeImageExportOptions.EnsureAccepted](/api/core/officeimo-drawing-officeimageexportoptions/#method-ensureaccepted-officeimo-drawing-officeimageexportresult)
- Method [OfficeImageExportResult.Require](/api/core/officeimo-drawing-officeimageexportresult/#method-require-officeimo-drawing-officeimageexportpolicy)
- Method [OfficeImageExportResult.Save](/api/core/officeimo-drawing-officeimageexportresult/#method-save-string-officeimo-drawing-officeimageexportfileconflictpolicy)
- Method [OfficeImageExportResult.SaveAsync](/api/core/officeimo-drawing-officeimageexportresult/#method-saveasync-string-officeimo-drawing-officeimageexportfileconflictpolicy-threading-cancellationtoken)
- Method [OfficeImageExportResult.WithDiagnostics](/api/core/officeimo-drawing-officeimageexportresult/#method-withdiagnostics-collections-generic-ireadonlylist-officeimo-drawing-officeimageexportdiagnostic)

### Accepted by parameters 6

- Method [OfficeImageExportAsyncConsumer.BeginInvoke](/api/core/officeimo-drawing-officeimageexportasyncconsumer/#method-begininvoke-officeimageexportresult-cancellationtoken-asynccallback-object) parameter `result`
- Method [OfficeImageExportAsyncConsumer.Invoke](/api/core/officeimo-drawing-officeimageexportasyncconsumer/#method-invoke-officeimageexportresult-cancellationtoken) parameter `result`
- Method [OfficeImageExportConsumer.BeginInvoke](/api/core/officeimo-drawing-officeimageexportconsumer/#method-begininvoke-officeimageexportresult-asynccallback-object) parameter `result`
- Method [OfficeImageExportConsumer.Invoke](/api/core/officeimo-drawing-officeimageexportconsumer/#method-invoke-officeimageexportresult) parameter `result`
- Method [OfficeImageExportOptions.EnsureAccepted](/api/core/officeimo-drawing-officeimageexportoptions/#method-ensureaccepted-officeimo-drawing-officeimageexportresult) parameter `result`
- Constructor [OfficeImageExportReport.OfficeImageExportReport](/api/core/officeimo-drawing-officeimageexportreport/#constructor-ctor-collections-generic-ienumerable-officeimo-drawing-officeimageexportresult) parameter `results`

Filter members 

Show inherited

## Constructors

`public OfficeImageExportResult(OfficeImageExportFormat format, int width, int height, byte[] bytes, string? name = null, string? source = null, IReadOnlyList<OfficeImageExportDiagnostic>? diagnostics = null, string? savedPath = null)` [#](#constructor-ctor-officeimo-drawing-officeimageexportformat-int32-int32-byte-string-string-collections-generic-ireadonlylist-officeimo-drawing-officeimageexportdiagnostic-string)

[OfficeImageExportResult.cs:31](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L31)

Creates an image export result after validating the complete encoded payload, declared format, and dimensions.

Parameters

**format OfficeIMO.Drawing.OfficeImageExportFormat required**

**width int required**

**height int required**

**bytes byte[] required**

**name string? = null optional**

**source string? = null optional**

**diagnostics System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficeImageExportDiagnostic>? = null optional**

**savedPath string? = null optional**

Exceptions

- `ArgumentException` – The encoded bytes are incomplete or invalid, do not match format, or do not have the declared width and height.

## Methods

`public OfficeImageExportReport CreateReport()` [#](#method-createreport)

[OfficeImageExportResult.cs:139](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L139)

Creates an aggregate report for this result.

Returns

`OfficeImageExportReport`

`public OfficeImageExportResult Require(OfficeImageExportPolicy policy)` [#](#method-require-officeimo-drawing-officeimageexportpolicy)

[OfficeImageExportResult.cs:143](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L143)

Throws when this result violates the supplied acceptance policy.

Parameters

**policy OfficeIMO.Drawing.OfficeImageExportPolicy required**

Returns

`OfficeImageExportResult`

Save 2 overloads

`public OfficeImageExportResult Save(string path, OfficeImageExportFileConflictPolicy conflictPolicy = FailIfExists)` [#](#method-save-string-officeimo-drawing-officeimageexportfileconflictpolicy)

[OfficeImageExportResult.cs:154](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L154)

Saves the encoded image to a file, appending the canonical extension when the path has none.

Parameters

**path string required**

**conflictPolicy OfficeIMO.Drawing.OfficeImageExportFileConflictPolicy = FailIfExists optional**

Returns

`OfficeImageExportResult`

`public OfficeImageExportResult Save(Stream stream)` [#](#method-save-io-stream)

[OfficeImageExportResult.cs:164](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L164)

Writes the encoded image to a caller-owned stream without closing it.

Parameters

**stream System.IO.Stream required**

Returns

`OfficeImageExportResult`

SaveAsync 2 overloads

`public async Task<OfficeImageExportResult> SaveAsync(string path, OfficeImageExportFileConflictPolicy conflictPolicy = FailIfExists, CancellationToken cancellationToken = default)` [#](#method-saveasync-string-officeimo-drawing-officeimageexportfileconflictpolicy-threading-cancellationtoken)

Asynchronously saves the encoded image to a file, appending the canonical extension when the path has none.

Parameters

**path string required**

**conflictPolicy OfficeIMO.Drawing.OfficeImageExportFileConflictPolicy = FailIfExists optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<OfficeImageExportResult>`

`public async Task<OfficeImageExportResult> SaveAsync(Stream stream, CancellationToken cancellationToken = default)` [#](#method-saveasync-io-stream-threading-cancellationtoken)

Asynchronously writes the encoded image to a caller-owned stream without closing it.

Parameters

**stream System.IO.Stream required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<OfficeImageExportResult>`

`public OfficeImageExportResult WithDiagnostics(IReadOnlyList<OfficeImageExportDiagnostic> diagnostics)` [#](#method-withdiagnostics-collections-generic-ireadonlylist-officeimo-drawing-officeimageexportdiagnostic)

[OfficeImageExportResult.cs:252](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L252)

Creates an immutable result copy with replacement diagnostics while preserving payload and batch metadata.

Parameters

**diagnostics System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficeImageExportDiagnostic> required**

Returns

`OfficeImageExportResult`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public OfficeImageExportFormat Format { get; }` [#](#property-format)

[OfficeImageExportResult.cs:88](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L88)

Output image format.

`public int Width { get; }` [#](#property-width)

[OfficeImageExportResult.cs:91](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L91)

Output width in pixels for raster formats or CSS pixels for SVG.

`public int Height { get; }` [#](#property-height)

[OfficeImageExportResult.cs:94](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L94)

Output height in pixels for raster formats or CSS pixels for SVG.

`public double DpiX { get; }` [#](#property-dpix)

[OfficeImageExportResult.cs:97](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L97)

Horizontal encoded resolution in dots per inch, defaulting to 96 when absent.

`public double DpiY { get; }` [#](#property-dpiy)

[OfficeImageExportResult.cs:100](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L100)

Vertical encoded resolution in dots per inch, defaulting to 96 when absent.

`public double PhysicalWidthInches { get; }` [#](#property-physicalwidthinches)

[OfficeImageExportResult.cs:103](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L103)

Physical width in inches according to encoded dimensions and resolution.

`public double PhysicalHeightInches { get; }` [#](#property-physicalheightinches)

[OfficeImageExportResult.cs:106](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L106)

Physical height in inches according to encoded dimensions and resolution.

`public string MimeType { get; }` [#](#property-mimetype)

[OfficeImageExportResult.cs:109](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L109)

Canonical MIME type for the encoded output.

`public string FileExtension { get; }` [#](#property-fileextension)

[OfficeImageExportResult.cs:112](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L112)

Canonical file extension, including the leading period.

`public byte[] Bytes { get; }` [#](#property-bytes)

[OfficeImageExportResult.cs:115](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L115)

Encoded image bytes.

`public long EncodedLength { get; }` [#](#property-encodedlength)

[OfficeImageExportResult.cs:118](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L118)

Encoded byte count without copying the payload.

`public string? Name { get; }` [#](#property-name)

[OfficeImageExportResult.cs:121](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L121)

Optional result name, such as a sheet or page name.

`public string? Source { get; }` [#](#property-source)

[OfficeImageExportResult.cs:124](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L124)

Optional source reference, such as a sheet range.

`public string? SavedPath { get; }` [#](#property-savedpath)

[OfficeImageExportResult.cs:127](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L127)

Normalized file path when this result was committed by a save operation.

`public int? SequenceIndex { get; }` [#](#property-sequenceindex)

[OfficeImageExportResult.cs:130](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L130)

Zero-based position in the batch that emitted this result, or null for a single export.

`public int? SequenceCount { get; }` [#](#property-sequencecount)

[OfficeImageExportResult.cs:133](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L133)

Total number of results when known before emission, or null for open-ended streaming batches.

`public IReadOnlyList<OfficeImageExportDiagnostic> Diagnostics { get; }` [#](#property-diagnostics)

[OfficeImageExportResult.cs:136](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageExportResult.cs#L136)

Diagnostics emitted while exporting.

<!-- PowerForge markdown artifact sha256:94801941505B58CAAC625CB32D77EE2A59F4222ED89A7D6412626DC7E50702C8 -->
