OfficeImageExportResult
OfficeIMO.Drawing
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
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
- width int
- height int
- bytes byte[]
- name string? = null
- source string? = null
- diagnostics System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficeImageExportDiagnostic>? = null
- savedPath string? = null
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.
Returns
OfficeImageExportReportpublic OfficeImageExportResult Require(OfficeImageExportPolicy policy) #Throws when this result violates the supplied acceptance policy.
Parameters
- policy OfficeIMO.Drawing.OfficeImageExportPolicy
Returns
OfficeImageExportResultpublic 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
- conflictPolicy OfficeIMO.Drawing.OfficeImageExportFileConflictPolicy = FailIfExists
Returns
OfficeImageExportResultpublic OfficeImageExportResult Save(Stream stream) #Writes the encoded image to a caller-owned stream without closing it.
Parameters
- stream System.IO.Stream
Returns
OfficeImageExportResultpublic 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
- conflictPolicy OfficeIMO.Drawing.OfficeImageExportFileConflictPolicy = FailIfExists
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<OfficeImageExportResult>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
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<OfficeImageExportResult>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>
Returns
OfficeImageExportResultInherited Methods
Properties
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 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.