Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

API Reference

Class

OfficeImageExportResult

Namespace OfficeIMO.Drawing
Assembly OfficeIMO.Core
Modifiers sealed

Result returned by dependency-free image export operations.

Inheritance

  • Object
  • OfficeImageExportResult

Usage

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

Accepted by parameters

Constructors

public OfficeImageExportResult(OfficeImageExportFormat format, Int32 width, Int32 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 requiredposition: 0
width System.Int32 requiredposition: 1
height System.Int32 requiredposition: 2
bytes System.Byte[] requiredposition: 3
name System.String = null optionalposition: 4
source System.String = null optionalposition: 5
diagnostics System.Collections.Generic.IReadOnlyList{OfficeIMO.Drawing.OfficeImageExportDiagnostic} = null optionalposition: 6
savedPath System.String = null optionalposition: 7

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() #
Returns: OfficeImageExportReport

Creates an aggregate report for this result.

public OfficeImageExportResult Require(OfficeImageExportPolicy policy) #
Returns: OfficeImageExportResult

Throws when this result violates the supplied acceptance policy.

Parameters

policy OfficeIMO.Drawing.OfficeImageExportPolicy requiredposition: 0
Save 2 overloads
public OfficeImageExportResult Save(String path, OfficeImageExportFileConflictPolicy conflictPolicy = FailIfExists) #
Returns: OfficeImageExportResult

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

Parameters

path System.String requiredposition: 0
conflictPolicy OfficeIMO.Drawing.OfficeImageExportFileConflictPolicy = FailIfExists optionalposition: 1
public OfficeImageExportResult Save(Stream stream) #
Returns: OfficeImageExportResult

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

Parameters

stream System.IO.Stream requiredposition: 0
SaveAsync 2 overloads
public async Task<OfficeImageExportResult> SaveAsync(String path, OfficeImageExportFileConflictPolicy conflictPolicy = FailIfExists, CancellationToken cancellationToken = default) #
Returns: Task<OfficeImageExportResult>

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

Parameters

path System.String requiredposition: 0
conflictPolicy OfficeIMO.Drawing.OfficeImageExportFileConflictPolicy = FailIfExists optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public async Task<OfficeImageExportResult> SaveAsync(Stream stream, CancellationToken cancellationToken = default) #
Returns: Task<OfficeImageExportResult>

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

Parameters

stream System.IO.Stream requiredposition: 0
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
public OfficeImageExportResult WithDiagnostics(IReadOnlyList<OfficeImageExportDiagnostic> diagnostics) #
Returns: OfficeImageExportResult

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

Parameters

diagnostics System.Collections.Generic.IReadOnlyList{OfficeIMO.Drawing.OfficeImageExportDiagnostic} requiredposition: 0

Properties

public OfficeImageExportFormat Format { get; } #

Output image format.

public Int32 Width { get; } #

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

public Int32 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 Int64 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 Nullable<Int32> SequenceIndex { get; } #

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

public Nullable<Int32> 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.