Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

OfficeImageExportResult

OfficeIMO.Drawing

Namespace
OfficeIMO.Drawing
Assembly
OfficeIMO.Core
Source revision
ba882f6b0d07 with working tree changes
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.

Accepted by parameters 6

Constructors

public OfficeImageExportResult(OfficeImageExportFormat format, int width, int height, byte[] bytes, string? name = null, string? source = null, IReadOnlyList<OfficeImageExportDiagnostic>? diagnostics = null, string? savedPath = null) #

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() #

Creates an aggregate report for this result.

public OfficeImageExportResult Require(OfficeImageExportPolicy policy) #

Throws when this result violates the supplied acceptance policy.

Parameters

policy OfficeIMO.Drawing.OfficeImageExportPolicy required
Save 2 overloads
public OfficeImageExportResult Save(string path, OfficeImageExportFileConflictPolicy conflictPolicy = FailIfExists) #

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
public OfficeImageExportResult Save(Stream stream) #

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

Parameters

stream System.IO.Stream required
SaveAsync 2 overloads
public async Task<OfficeImageExportResult> SaveAsync(string path, OfficeImageExportFileConflictPolicy conflictPolicy = FailIfExists, CancellationToken cancellationToken = default) #

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
public async Task<OfficeImageExportResult> SaveAsync(Stream stream, CancellationToken cancellationToken = default) #

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
public OfficeImageExportResult WithDiagnostics(IReadOnlyList<OfficeImageExportDiagnostic> diagnostics) #

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

Parameters

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

Properties

public OfficeImageExportFormat Format { get; } #

Output image format.

public int Width { get; } #

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

public int Height { get; } #

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

public double DpiX { get; } #

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

public double DpiY { get; } #

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

public double PhysicalWidthInches { get; } #

Physical width in inches according to encoded dimensions and resolution.

public double PhysicalHeightInches { get; } #

Physical height in inches according to encoded dimensions and resolution.

public string MimeType { get; } #

Canonical MIME type for the encoded output.

public string FileExtension { get; } #

Canonical file extension, including the leading period.

public byte[] Bytes { get; } #

Encoded image bytes.

public long EncodedLength { get; } #

Encoded byte count without copying the payload.

public string? Name { get; } #

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

public string? Source { get; } #

Optional source reference, such as a sheet range.

public string? SavedPath { get; } #

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

public int? SequenceIndex { get; } #

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

public int? SequenceCount { get; } #

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

public IReadOnlyList<OfficeImageExportDiagnostic> Diagnostics { get; } #

Diagnostics emitted while exporting.