API Reference

Class

ExcelDocument

Namespace OfficeIMO.Excel
Assembly OfficeIMO.Excel
Implements
IDisposable IAsyncDisposable
Attributes
DefaultMember("Item")

Represents an Excel document and provides methods for creating, loading and saving spreadsheets.

Inheritance

  • Object
  • ExcelDocument

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

Methods

public Void AddBackLinksToToc(String tocSheetName = "TOC", Int32 row = 2, Int32 col = 1, String text = "โ† TOC") #
Returns: Void

Adds a small back link to the TOC on each worksheet at the given cell (default A2).

Parameters

tocSheetName System.String = "TOC" optionalposition: 0
row System.Int32 = 2 optionalposition: 1
col System.Int32 = 1 optionalposition: 2
text System.String = "โ† TOC" optionalposition: 3
AddMacro 3 overloads
public Void AddMacro(Byte[] data) #
Returns: Void

Adds or replaces a vbaProject.bin payload.

Parameters

data System.Byte[] requiredposition: 0
public Void AddMacro(String filePath) #
Returns: Void

Adds or replaces a VBA project from a file.

Parameters

filePath System.String requiredposition: 0
public Void AddMacro(Stream stream, Nullable<Int64> maxBytes = null) #
Returns: Void

Adds or replaces a VBA project from a readable stream.

Parameters

stream System.IO.Stream requiredposition: 0
maxBytes System.Nullable{System.Int64} = null optionalposition: 1
public ExcelPivotInteractionInfo AddPivotSlicer(String pivotTableName, String sourceField, String worksheetName, ExcelSlicerViewOptions options = null) #
Returns: ExcelPivotInteractionInfo

Adds a native Excel slicer view bound to a PivotTable field.

Parameters

pivotTableName System.String requiredposition: 0
sourceField System.String requiredposition: 1
worksheetName System.String requiredposition: 2
options OfficeIMO.Excel.ExcelSlicerViewOptions = null optionalposition: 3
public ExcelPackagePartInfo AddPivotSlicerCache(String pivotTableName, String sourceField, String cacheName = null) #
Returns: ExcelPackagePartInfo

Adds slicer cache metadata bound to a validated pivot table field.

Parameters

pivotTableName System.String requiredposition: 0
sourceField System.String requiredposition: 1
cacheName System.String = null optionalposition: 2
public ExcelPivotInteractionInfo AddPivotTimeline(String pivotTableName, String sourceField, String worksheetName, ExcelTimelineViewOptions options = null) #
Returns: ExcelPivotInteractionInfo

Adds a native Excel timeline view bound to a date-only PivotTable field.

Parameters

pivotTableName System.String requiredposition: 0
sourceField System.String requiredposition: 1
worksheetName System.String requiredposition: 2
options OfficeIMO.Excel.ExcelTimelineViewOptions = null optionalposition: 3
public ExcelPackagePartInfo AddPivotTimelineCache(String pivotTableName, String sourceField, String cacheName = null) #
Returns: ExcelPackagePartInfo

Adds timeline cache metadata bound to a validated pivot table field.

Parameters

pivotTableName System.String requiredposition: 0
sourceField System.String requiredposition: 1
cacheName System.String = null optionalposition: 2
public ExcelPowerQueryMetadataResult AddPowerQueryMetadata(ExcelPowerQueryMetadataOptions options) #
Returns: ExcelPowerQueryMetadataResult

Authors safe connection/query-table metadata for Excel-compatible applications to own and refresh. OfficeIMO writes metadata only; it does not execute Power Query M or contact external systems.

Parameters

options OfficeIMO.Excel.ExcelPowerQueryMetadataOptions requiredposition: 0
public ExcelQueryBackedTableInfo AddQueryBackedTable(ExcelQueryBackedTableOptions options) #
Returns: ExcelQueryBackedTableInfo

Creates a native query-backed worksheet table without executing its command.

Parameters

options OfficeIMO.Excel.ExcelQueryBackedTableOptions requiredposition: 0
public Void AddTableOfContents(String sheetName = "TOC", Boolean placeFirst = true, Boolean withHyperlinks = true, Boolean includeNamedRanges = false, Boolean includeHiddenNamedRanges = false, Predicate<String> rangeNameFilter = null, Boolean styled = true) #
Returns: Void

Adds or refreshes a visually styled Table of Contents sheet with hyperlinks.

Parameters

sheetName System.String = "TOC" optionalposition: 0
TOC sheet name.
placeFirst System.Boolean = true optionalposition: 1
Move TOC as the first sheet.
withHyperlinks System.Boolean = true optionalposition: 2
Create internal hyperlinks.
includeNamedRanges System.Boolean = false optionalposition: 3
Also list defined names in a dedicated column.
includeHiddenNamedRanges System.Boolean = false optionalposition: 4
When listing defined names, include ones marked Hidden.
rangeNameFilter System.Predicate{System.String} = null optionalposition: 5
Optional filter to include only matching defined names.
styled System.Boolean = true optionalposition: 6
When true, renders a banner and a formatted table with AutoFilter.
public ExcelPackagePartInfo AddWorkbookConnectionMetadata(String xml) #
Returns: ExcelPackagePartInfo

Adds caller-supplied workbook connection metadata XML as a workbook package part. OfficeIMO preserves this metadata but does not execute or refresh external connections.

Parameters

xml System.String requiredposition: 0
Connection metadata XML.

Returns

Information identifying the added or updated package part.

public ExcelPackagePartInfo AddWorkbookMetadataPart(String relationshipType, String contentType, String xml, String targetExtension = "xml") #
Returns: ExcelPackagePartInfo

Adds caller-supplied XML as a workbook package metadata part.

Parameters

relationshipType System.String requiredposition: 0
Open XML relationship type.
contentType System.String requiredposition: 1
Package part content type.
xml System.String requiredposition: 2
Metadata XML.
targetExtension System.String = "xml" optionalposition: 3
Target extension for the generated package part.

Returns

Information identifying the added package part.

public ExcelPackagePartInfo AddWorkbookSlicerCache(ExcelSlicerCacheOptions options) #
Returns: ExcelPackagePartInfo

Adds OfficeIMO-owned workbook-level slicer binding metadata. This does not impersonate a native Excel slicer-cache part; native cache structures and UI shapes must be materialized separately.

Parameters

options OfficeIMO.Excel.ExcelSlicerCacheOptions requiredposition: 0
Slicer cache metadata options.

Returns

Information identifying the added package part.

public ExcelPackagePartInfo AddWorkbookTimelineCache(ExcelTimelineCacheOptions options) #
Returns: ExcelPackagePartInfo

Adds OfficeIMO-owned workbook-level timeline binding metadata. This does not impersonate a native Excel timeline-cache part; native cache structures and UI shapes must be materialized separately.

Parameters

options OfficeIMO.Excel.ExcelTimelineCacheOptions requiredposition: 0
Timeline cache metadata options.

Returns

Information identifying the added package part.

AddWorksheet 2 overloads
public ExcelSheet AddWorksheet(String worksheetName = "") #
Returns: ExcelSheet

Adds a worksheet to the document.

Parameters

worksheetName System.String = "" optionalposition: 0
Worksheet name.

Returns

Created ExcelSheet instance.

public ExcelSheet AddWorksheet(String worksheetName, ExcelSheetNameValidationMode validationMode) #
Returns: ExcelSheet

Adds a worksheet to the document with control over name validation.

Parameters

worksheetName System.String requiredposition: 0
Requested worksheet name.
validationMode OfficeIMO.Excel.ExcelSheetNameValidationMode requiredposition: 1
How to validate the sheet name: None (no checks), Sanitize (coerce), or Strict (throw on invalid).

Returns

Created ExcelSheet instance.

public ExcelPackagePartInfo AddWorksheetMetadataPart(ExcelSheet sheet, String relationshipType, String contentType, String xml, String targetExtension = "xml") #
Returns: ExcelPackagePartInfo

Adds caller-supplied XML as a worksheet package metadata part.

Parameters

sheet OfficeIMO.Excel.ExcelSheet requiredposition: 0
Worksheet that owns the metadata part.
relationshipType System.String requiredposition: 1
Open XML relationship type.
contentType System.String requiredposition: 2
Package part content type.
xml System.String requiredposition: 3
Metadata XML.
targetExtension System.String = "xml" optionalposition: 4
Target extension for the generated package part.

Returns

Information identifying the added package part.

public ExcelPackagePartInfo AddWorksheetQueryTableMetadata(String worksheetName, String xml) #
Returns: ExcelPackagePartInfo

Adds caller-supplied query-table metadata XML as a worksheet package part. OfficeIMO preserves this metadata but does not execute or refresh external queries.

Parameters

worksheetName System.String requiredposition: 0
Worksheet that owns the query-table metadata.
xml System.String requiredposition: 1
Query-table metadata XML.

Returns

Information identifying the added package part.

public ExcelAccessibilityReport AnalyzeAccessibility() #
Returns: ExcelAccessibilityReport

Reports workbook accessibility and compliance issues such as missing alt text, hidden sheets, merged cells, and missing table headers.

public static ExcelDocumentConversionReport AnalyzeConversion(String sourcePath, String destinationPath, ExcelDocumentConversionOptions options = null) #
Returns: ExcelDocumentConversionReport

Analyzes a file-to-file Excel conversion without creating or changing an artifact.

Parameters

sourcePath System.String requiredposition: 0
destinationPath System.String requiredposition: 1
options OfficeIMO.Excel.ExcelDocumentConversionOptions = null optionalposition: 2
public static async Task<ExcelDocumentConversionReport> AnalyzeConversionAsync(String sourcePath, String destinationPath, ExcelDocumentConversionOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<ExcelDocumentConversionReport>

Asynchronously analyzes a file-to-file Excel conversion without creating or changing an artifact.

Parameters

sourcePath System.String requiredposition: 0
destinationPath System.String requiredposition: 1
options OfficeIMO.Excel.ExcelDocumentConversionOptions = null optionalposition: 2
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
public ExcelFormulaAnalysisReport AnalyzeFormulas() #
Returns: ExcelFormulaAnalysisReport

Analyzes formulas for references, external links, and volatile functions.

ApplyTemplate 4 overloads
public Int32 ApplyTemplate(IDictionary<String, Object> values, IFormatProvider provider = null, Boolean throwOnMissing = false) #
Returns: Int32

Replaces {{Marker}} placeholders across all worksheets using the supplied values.

Parameters

values System.Collections.Generic.IDictionary{System.String,System.Object} requiredposition: 0
provider System.IFormatProvider = null optionalposition: 1
throwOnMissing System.Boolean = false optionalposition: 2
public Int32 ApplyTemplate(IDictionary<String, Object> values, ExcelTemplateOptions options) #
Returns: Int32

Replaces {{Marker}} placeholders across all worksheets using the supplied values and options.

Parameters

values System.Collections.Generic.IDictionary{System.String,System.Object} requiredposition: 0
options OfficeIMO.Excel.ExcelTemplateOptions requiredposition: 1
public Int32 ApplyTemplate(Object model, IFormatProvider provider = null, Boolean throwOnMissing = false) #
Returns: Int32

Replaces {{Marker}} placeholders across all worksheets using public properties from the supplied model. Nested properties are exposed as dotted marker names, for example {{Customer.Name}}.

Parameters

model System.Object requiredposition: 0
provider System.IFormatProvider = null optionalposition: 1
throwOnMissing System.Boolean = false optionalposition: 2
public Int32 ApplyTemplate(Object model, ExcelTemplateOptions options) #
Returns: Int32

Replaces {{Marker}} placeholders across all worksheets using public properties from the supplied model and options. Nested properties are exposed as dotted marker names, for example {{Customer.Name}}.

Parameters

model System.Object requiredposition: 0
options OfficeIMO.Excel.ExcelTemplateOptions requiredposition: 1
public Int32 ApplyTemplateSheets(String templateSheetName, IEnumerable<IDictionary<String, Object>> sheets, Func<IDictionary<String, Object>, Int32, String> sheetNameSelector = null, ExcelTemplateOptions options = null) #
Returns: Int32

Repeats a template worksheet for each supplied value dictionary and applies markers to each generated sheet.

Parameters

templateSheetName System.String requiredposition: 0
Worksheet to use as the sheet template.
sheets System.Collections.Generic.IEnumerable{System.Collections.Generic.IDictionary{System.String,System.Object}} requiredposition: 1
Per-sheet value dictionaries.
sheetNameSelector System.Func{System.Collections.Generic.IDictionary{System.String,System.Object},System.Int32,System.String} = null optionalposition: 2
Optional generated sheet name selector. The index is zero-based.
options OfficeIMO.Excel.ExcelTemplateOptions = null optionalposition: 3
Optional template binding options.

Returns

Total marker replacements across all generated sheets.

public Int32 ApplyTemplateSheets<T>(String templateSheetName, IEnumerable<T> models, Func<T, Int32, String> sheetNameSelector = null, ExcelTemplateOptions options = null) #
Returns: Int32

Repeats a template worksheet for each supplied model and applies markers to each generated sheet. Public properties are exposed as marker names, including nested dotted names.

Type Parameters

T

Parameters

templateSheetName System.String requiredposition: 0
Worksheet to use as the sheet template.
models System.Collections.Generic.IEnumerable{``0} requiredposition: 1
Per-sheet models.
sheetNameSelector System.Func{``0,System.Int32,System.String} = null optionalposition: 2
Optional generated sheet name selector. The index is zero-based.
options OfficeIMO.Excel.ExcelTemplateOptions = null optionalposition: 3
Optional template binding options.

Returns

Total marker replacements across all generated sheets.

public ExcelFluentWorkbook AsFluent() #
Returns: ExcelFluentWorkbook

Returns a fluent API wrapper for this document.

public Int32 Calculate() #
Returns: Int32

Calculates formulas that are supported by OfficeIMO's lightweight formula engine and writes cached values. Unsupported formulas are preserved unchanged for Excel-compatible applications to calculate.

Returns

The number of formula cells with updated cached values.

public Void ClearCachedFormulaResults() #
Returns: Void

Removes cached values from all formula cells.

public Void ClearWriteReservation() #
Returns: Void

Removes workbook write-reservation metadata.

public IReadOnlyList<ExcelRangeDifference> CompareRanges(ExcelSheet leftSheet, String leftRange, ExcelSheet rightSheet, String rightRange, ExcelRangeCompareOptions options = null) #
Returns: IReadOnlyList<ExcelRangeDifference>

Compares two worksheet ranges and returns cell-level differences.

Parameters

leftSheet OfficeIMO.Excel.ExcelSheet requiredposition: 0
leftRange System.String requiredposition: 1
rightSheet OfficeIMO.Excel.ExcelSheet requiredposition: 2
rightRange System.String requiredposition: 3
options OfficeIMO.Excel.ExcelRangeCompareOptions = null optionalposition: 4
CompareWorkbook 2 overloads
public ExcelWorkbookDiffReport CompareWorkbook(ExcelDocument other, ExcelWorkbookDiffOptions options) #
Returns: ExcelWorkbookDiffReport

Compares this workbook with another workbook using configurable structural, value, style, table, comment, and metadata checks.

Parameters

other OfficeIMO.Excel.ExcelDocument requiredposition: 0
options OfficeIMO.Excel.ExcelWorkbookDiffOptions requiredposition: 1
public ExcelWorkbookDiffReport CompareWorkbook(ExcelDocument other, Int32 maxDifferences = 200) #
Returns: ExcelWorkbookDiffReport

Compares this workbook with another workbook by sheets, dimensions, formulas, and visible cell text.

Parameters

other OfficeIMO.Excel.ExcelDocument requiredposition: 0
maxDifferences System.Int32 = 200 optionalposition: 1
public IReadOnlyList<ExcelRangeDifference> CompareWorksheets(ExcelSheet leftSheet, ExcelSheet rightSheet, ExcelRangeCompareOptions options = null) #
Returns: IReadOnlyList<ExcelRangeDifference>

Compares the used ranges of two worksheets.

Parameters

leftSheet OfficeIMO.Excel.ExcelSheet requiredposition: 0
rightSheet OfficeIMO.Excel.ExcelSheet requiredposition: 1
options OfficeIMO.Excel.ExcelRangeCompareOptions = null optionalposition: 2
public Void Compose(String sheetName, Action<SheetComposer> compose, SheetTheme theme = null) #
Returns: Void

Fluent sugar: compose a worksheet using SheetComposer without exposing the builder type to callers.

Parameters

sheetName System.String requiredposition: 0
compose System.Action{OfficeIMO.Excel.Fluent.SheetComposer} requiredposition: 1
theme OfficeIMO.Excel.Fluent.SheetTheme = null optionalposition: 2
public Void ConfigureFullCalculationOnOpen() #
Returns: Void

Requests a full workbook recalculation when the file is opened.

public static ExcelDocumentConversionResult Convert(String sourcePath, String destinationPath, ExcelDocumentConversionOptions options = null) #
Returns: ExcelDocumentConversionResult

Converts an Excel file between XLS and XLSX and returns format and fidelity diagnostics.

Parameters

sourcePath System.String requiredposition: 0
Path to the source XLS or XLSX file.
destinationPath System.String requiredposition: 1
Path to the destination XLS or XLSX file.
options OfficeIMO.Excel.ExcelDocumentConversionOptions = null optionalposition: 2
Optional conversion policy settings.

Returns

The completed conversion result.

public static async Task<ExcelDocumentConversionResult> ConvertAsync(String sourcePath, String destinationPath, ExcelDocumentConversionOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<ExcelDocumentConversionResult>

Asynchronously converts an Excel file between XLS and XLSX.

Parameters

sourcePath System.String requiredposition: 0
Path to the source XLS or XLSX file.
destinationPath System.String requiredposition: 1
Path to the destination XLS or XLSX file.
options OfficeIMO.Excel.ExcelDocumentConversionOptions = null optionalposition: 2
Optional conversion policy settings.
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
Cancellation token.

Returns

The completed conversion result.

CopyPackage 2 overloads
public static Void CopyPackage(String sourcePath, String destinationPath, Boolean overwrite = true) #
Returns: Void

Copies an existing workbook or template package to a destination path while preserving package parts. The workbook content type is normalized for the destination extension.

Parameters

sourcePath System.String requiredposition: 0
Path to the source workbook or template package.
destinationPath System.String requiredposition: 1
Destination workbook path.
overwrite System.Boolean = true optionalposition: 2
When true, replaces an existing destination file.
public static Void CopyPackage(Stream sourceStream, String destinationPath, Boolean overwrite = true) #
Returns: Void

Copies a workbook or template package stream to a destination path while preserving package parts. The workbook content type is normalized for the destination extension.

Parameters

sourceStream System.IO.Stream requiredposition: 0
Readable workbook package stream.
destinationPath System.String requiredposition: 1
Destination workbook path.
overwrite System.Boolean = true optionalposition: 2
When true, replaces an existing destination file.
CopyWorksheet 2 overloads
public ExcelSheet CopyWorksheet(String sourceSheetName, String newSheetName, ExcelSheetNameValidationMode validationMode = Sanitize) #
Returns: ExcelSheet

Copies a worksheet within this workbook.

Parameters

sourceSheetName System.String requiredposition: 0
Name of the worksheet to copy.
newSheetName System.String requiredposition: 1
Requested name for the copied worksheet.
validationMode OfficeIMO.Excel.ExcelSheetNameValidationMode = Sanitize optionalposition: 2
How to validate or sanitize newSheetName.

Returns

The copied worksheet.

public ExcelSheet CopyWorksheet(ExcelSheet sourceSheet, String newSheetName, ExcelSheetNameValidationMode validationMode = Sanitize) #
Returns: ExcelSheet

Copies a worksheet within this workbook.

Parameters

sourceSheet OfficeIMO.Excel.ExcelSheet requiredposition: 0
Worksheet to copy.
newSheetName System.String requiredposition: 1
Requested name for the copied worksheet.
validationMode OfficeIMO.Excel.ExcelSheetNameValidationMode = Sanitize optionalposition: 2
How to validate or sanitize newSheetName.

Returns

The copied worksheet.

CopyWorksheetFrom 2 overloads
public ExcelSheet CopyWorksheetFrom(ExcelDocument sourceDocument, String sourceSheetName, String newSheetName, ExcelSheetNameValidationMode validationMode = Sanitize) #
Returns: ExcelSheet

Copies a worksheet from another workbook into this workbook.

Parameters

sourceDocument OfficeIMO.Excel.ExcelDocument requiredposition: 0
Workbook containing the source worksheet.
sourceSheetName System.String requiredposition: 1
Name of the worksheet to copy.
newSheetName System.String requiredposition: 2
Requested name for the copied worksheet.
validationMode OfficeIMO.Excel.ExcelSheetNameValidationMode = Sanitize optionalposition: 3
How to validate or sanitize newSheetName.

Returns

The copied worksheet.

public ExcelSheet CopyWorksheetFrom(ExcelDocument sourceDocument, String sourceSheetName, String newSheetName, ExcelSheetNameValidationMode validationMode, ExcelWorksheetCopyOptions options) #
Returns: ExcelSheet

Copies a worksheet from another workbook into this workbook.

Parameters

sourceDocument OfficeIMO.Excel.ExcelDocument requiredposition: 0
Workbook containing the source worksheet.
sourceSheetName System.String requiredposition: 1
Name of the worksheet to copy.
newSheetName System.String requiredposition: 2
Requested name for the copied worksheet.
validationMode OfficeIMO.Excel.ExcelSheetNameValidationMode requiredposition: 3
How to validate or sanitize newSheetName.
options OfficeIMO.Excel.ExcelWorksheetCopyOptions requiredposition: 4
Copy strategy options.

Returns

The copied worksheet.

Create 4 overloads
public static ExcelDocument Create(ExcelCreateOptions options = null) #
Returns: ExcelDocument

Creates a detached workbook that must be saved explicitly to a path or stream.

Parameters

options OfficeIMO.Excel.ExcelCreateOptions = null optionalposition: 0
Creation options. SaveOnDispose is invalid without an associated destination.
public static ExcelDocument Create(String filePath, ExcelCreateOptions options = null) #
Returns: ExcelDocument

Creates a new Excel document at the specified path.

Parameters

filePath System.String requiredposition: 0
Path to the new file.
options OfficeIMO.Excel.ExcelCreateOptions = null optionalposition: 1
Creation and persistence options.

Returns

Created ExcelDocument instance.

public static ExcelDocument Create(Stream stream, ExcelCreateOptions options = null) #
Returns: ExcelDocument

Creates a new Excel document in memory and optionally persists it to the provided stream on dispose.

Parameters

stream System.IO.Stream requiredposition: 0
Destination stream to receive the workbook package.
options OfficeIMO.Excel.ExcelCreateOptions = null optionalposition: 1
Creation and persistence options.

Returns

Created ExcelDocument instance.

public static ExcelDocument Create(String filePath, String worksheetName) #
Returns: ExcelDocument

Creates a new Excel document with a single worksheet.

Parameters

filePath System.String requiredposition: 0
Path to the new file.
worksheetName System.String requiredposition: 1
Name of the worksheet.

Returns

Created ExcelDocument instance.

public ExcelWorkbookDataReader CreateDataReader(ExcelReadOptions options = null) #
Returns: ExcelWorkbookDataReader

Creates a forward-only data reader over this open workbook document. The returned reader does not close the document.

Parameters

options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 0
CreateFromTemplate 2 overloads
public static ExcelDocument CreateFromTemplate(String templatePath, String filePath, ExcelTemplateCreateOptions options = null) #
Returns: ExcelDocument

Creates an editable workbook by copying a template package to a destination path and loading the copy. Package parts such as styles, themes, drawings, tables, named ranges, and worksheet metadata are preserved.

Parameters

templatePath System.String requiredposition: 0
Path to the source workbook or template package.
filePath System.String requiredposition: 1
Destination workbook path.
options OfficeIMO.Excel.ExcelTemplateCreateOptions = null optionalposition: 2
Template creation, persistence, and package options.

Returns

The loaded destination workbook.

public static ExcelDocument CreateFromTemplate(Stream templateStream, String filePath, ExcelTemplateCreateOptions options = null) #
Returns: ExcelDocument

Creates an editable workbook by copying a template package stream to a destination path and loading the copy.

Parameters

templateStream System.IO.Stream requiredposition: 0
Readable template package stream.
filePath System.String requiredposition: 1
Destination workbook path.
options OfficeIMO.Excel.ExcelTemplateCreateOptions = null optionalposition: 2
Template creation, persistence, and package options.

Returns

The loaded destination workbook.

public ExcelWorkbookSnapshot CreateInspectionSnapshot(ExcelReadOptions options = null) #
Returns: ExcelWorkbookSnapshot

Creates an immutable workbook snapshot that exposes OfficeIMO's current workbook model for downstream integrations.

Parameters

options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 0
public virtual Void Dispose() #
Returns: Void

Releases resources used by the document.

public virtual async ValueTask DisposeAsync() #
Returns: ValueTask

Asynchronously releases resources used by the document.

public ExcelDocument EnsureWorkbookTheme() #
Returns: ExcelDocument

Ensures the workbook contains the default Office theme and stylesheet parts.

ExportImages 2 overloads
public IReadOnlyList<OfficeImageExportResult> ExportImages(OfficeImageExportFormat format, ExcelWorkbookImageExportOptions options = null) #
Returns: IReadOnlyList<OfficeImageExportResult>

Exports workbook sheets as supported raster formats or SVG images.

Parameters

format OfficeIMO.Drawing.OfficeImageExportFormat requiredposition: 0
options OfficeIMO.Excel.ExcelWorkbookImageExportOptions = null optionalposition: 1
public Void ExportImages(OfficeImageExportFormat format, OfficeImageExportConsumer consumer, ExcelWorkbookImageExportOptions options = null, CancellationToken cancellationToken = null) #
Returns: Void

Streams workbook images to a consumer without retaining earlier payloads.

Parameters

format OfficeIMO.Drawing.OfficeImageExportFormat requiredposition: 0
consumer OfficeIMO.Drawing.OfficeImageExportConsumer requiredposition: 1
options OfficeIMO.Excel.ExcelWorkbookImageExportOptions = null optionalposition: 2
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
public Byte[] ExtractEmbeddedPayload(String id, Nullable<Int64> maxBytes = null) #
Returns: Byte[]

Extracts an embedded payload by its package-local id.

Parameters

id System.String requiredposition: 0
maxBytes System.Nullable{System.Int64} = null optionalposition: 1
public Byte[] ExtractMacros(Nullable<Int64> maxBytes = null) #
Returns: Byte[]

Extracts the VBA project, or an empty array when no project exists.

Parameters

maxBytes System.Nullable{System.Int64} = null optionalposition: 0
public IReadOnlyDictionary<String, String> GetAllNamedRanges(ExcelSheet scope = null) #
Returns: IReadOnlyDictionary<String, String>

Returns all defined names with their A1 ranges, optionally limited to a sheet scope.

Parameters

scope OfficeIMO.Excel.ExcelSheet = null optionalposition: 0
public IReadOnlyList<OfficeEmbeddedPayloadInfo> GetEmbeddedPayloads(Boolean includeSha256 = false) #
Returns: IReadOnlyList<OfficeEmbeddedPayloadInfo>

Gets embedded package, OLE, and ActiveX payload metadata.

Parameters

includeSha256 System.Boolean = false optionalposition: 0
public String GetNamedRange(String name, ExcelSheet scope = null) #
Returns: String

Returns the A1 range for a defined name. If scope is supplied, searches a sheetโ€‘local name first.

Parameters

name System.String requiredposition: 0
Defined name to resolve.
scope OfficeIMO.Excel.ExcelSheet = null optionalposition: 1
Optional sheet scope to resolve a local name.

Returns

A1 range string or null if not found.

public IReadOnlyList<ExcelNamedStyleInfo> GetNamedStyles() #
Returns: IReadOnlyList<ExcelNamedStyleInfo>

Lists workbook named styles.

public IReadOnlyList<ExcelPivotInteractionInfo> GetPivotInteractions() #
Returns: IReadOnlyList<ExcelPivotInteractionInfo>

Returns native slicer and timeline views across the workbook.

public IReadOnlyList<ExcelPivotTableInfo> GetPivotTables() #
Returns: IReadOnlyList<ExcelPivotTableInfo>

Returns all pivot tables defined in the workbook.

public IReadOnlyList<ExcelQueryBackedTableInfo> GetQueryBackedTables() #
Returns: IReadOnlyList<ExcelQueryBackedTableInfo>

Lists query-backed worksheet tables that have a resolvable native query-table relationship.

public ExcelSheet GetSheet(String name) #
Returns: ExcelSheet

Gets a worksheet by name.

Parameters

name System.String requiredposition: 0
public IReadOnlyList<String> GetSheetNames() #
Returns: IReadOnlyList<String>

Returns worksheet names in workbook order.

public ExcelStreamingContractReport GetStreamingContract() #
Returns: ExcelStreamingContractReport

Returns a streaming/read-write contract summary for large workbook workflows.

public IReadOnlyList<ExcelTableInfo> GetTables() #
Returns: IReadOnlyList<ExcelTableInfo>

Returns all Excel tables defined in the workbook.

public IReadOnlyList<ExcelPivotInteractionCacheInfo> GetWorkbookSlicerCaches() #
Returns: IReadOnlyList<ExcelPivotInteractionCacheInfo>

Returns workbook-level slicer cache metadata parts.

public ExcelWorkbookThemeInfo GetWorkbookTheme(Boolean includeXml = false) #
Returns: ExcelWorkbookThemeInfo

Gets workbook theme metadata and optionally includes the raw theme XML.

Parameters

includeXml System.Boolean = false optionalposition: 0
public String GetWorkbookThemeXml() #
Returns: String

Gets the raw workbook theme XML when a theme part exists.

public IReadOnlyList<ExcelPivotInteractionCacheInfo> GetWorkbookTimelineCaches() #
Returns: IReadOnlyList<ExcelPivotInteractionCacheInfo>

Returns workbook-level timeline cache metadata parts.

public ExcelWorkbookWriteReservationInfo GetWriteReservation() #
Returns: ExcelWorkbookWriteReservationInfo

Gets workbook write-reservation metadata. This is separate from workbook protection and package encryption.

public IReadOnlyList<ExcelDataSetImportResult> InsertDataSet(DataSet dataSet, Boolean createTables = true, ExcelTableStyle tableStyle = TableStyleMedium2, Boolean includeHeaders = true, Boolean includeAutoFilter = true, Boolean autoFit = false, Nullable<ExcelExecutionMode> mode = null, CancellationToken ct = null) #
Returns: IReadOnlyList<ExcelDataSetImportResult>

Imports a DataSet into the workbook with one worksheet per source DataTable.

Parameters

dataSet System.Data.DataSet requiredposition: 0
Source dataset.
createTables System.Boolean = true optionalposition: 1
Create an Excel table over each imported DataTable.
tableStyle OfficeIMO.Excel.ExcelTableStyle = TableStyleMedium2 optionalposition: 2
Excel table style to use when createTables is true.
includeHeaders System.Boolean = true optionalposition: 3
Write source column names as the first row.
includeAutoFilter System.Boolean = true optionalposition: 4
Include table AutoFilter dropdowns when creating tables.
autoFit System.Boolean = false optionalposition: 5
Auto-fit imported columns after each sheet is created.
mode System.Nullable{OfficeIMO.Excel.ExcelExecutionMode} = null optionalposition: 6
Optional execution mode override for DataTable writes.
ct System.Threading.CancellationToken = null optionalposition: 7
Cancellation token.

Returns

Import results describing the created worksheets and ranges.

public ExcelWorkbookCommentReport InspectComments() #
Returns: ExcelWorkbookCommentReport

Audits legacy notes and threaded comments across the workbook.

public ExcelDataModelReport InspectDataModel() #
Returns: ExcelDataModelReport

Inspects data model, Power Query, connection, query table, and external link package parts.

public ExcelFeatureReport InspectFeatures() #
Returns: ExcelFeatureReport

Inspects workbook features and reports which ones OfficeIMO can edit, partially edit, preserve, or does not support yet.

public ExcelFormulaInspection InspectFormulas() #
Returns: ExcelFormulaInspection

Inspects formula cells across all worksheets without changing workbook contents.

public static OfficePackageSignatureInfo InspectPackageSignatures(String filePath, OfficePackageSignatureInspectionOptions options = null) #
Returns: OfficePackageSignatureInfo

Inspects a saved XLSX/XLSM package through the shared dependency-light OPC signature engine.

Parameters

filePath System.String requiredposition: 0
options OfficeIMO.Security.OfficePackageSignatureInspectionOptions = null optionalposition: 1
public ExcelSignatureInfo InspectSignatures() #
Returns: ExcelSignatureInfo

Inspects package-level digital-signature metadata without validating cryptographic trust.

InspectTemplate 3 overloads
public ExcelTemplateInspection InspectTemplate() #
Returns: ExcelTemplateInspection

Inspects {{Marker}} placeholders across all worksheets without modifying the workbook.

public ExcelTemplateInspection InspectTemplate(IDictionary<String, Object> values) #
Returns: ExcelTemplateInspection

Inspects {{Marker}} placeholders across all worksheets and reports which markers are missing from the supplied values.

Parameters

values System.Collections.Generic.IDictionary{System.String,System.Object} requiredposition: 0
public ExcelTemplateInspection InspectTemplate(Object model) #
Returns: ExcelTemplateInspection

Inspects {{Marker}} placeholders across all worksheets and reports which markers are missing from public properties on the supplied model.

Parameters

model System.Object requiredposition: 0
InspectVbaProject 2 overloads
public OfficeVbaProjectInfo InspectVbaProject(Boolean includeSha256 = false) #
Returns: OfficeVbaProjectInfo

Inspects the attached VBA project without executing macro code.

Parameters

includeSha256 System.Boolean = false optionalposition: 0
public OfficeVbaProjectInfo InspectVbaProject(Boolean includeSha256, Int64 maxBytes) #
Returns: OfficeVbaProjectInfo

Inspects the attached VBA project while enforcing a decoded byte limit.

Parameters

includeSha256 System.Boolean requiredposition: 0
maxBytes System.Int64 requiredposition: 1
public static OfficeVbaSignatureInfo InspectVbaSignatures(String filePath, OfficeVbaSignatureInspectionOptions options = null) #
Returns: OfficeVbaSignatureInfo

Inspects legacy, agile, and V3 VBA signature profiles in a saved XLSM/XLTM/XLAM package.

Parameters

filePath System.String requiredposition: 0
options OfficeIMO.Security.OfficeVbaSignatureInspectionOptions = null optionalposition: 1
public Void InvalidateFormulas() #
Returns: Void

Marks all formulas dirty so Excel-compatible applications recalculate them on open.

public IReadOnlyList<ExcelNamedRangeInfo> ListNamedRanges(Boolean includeBuiltIn = true, Boolean includeHidden = true) #
Returns: IReadOnlyList<ExcelNamedRangeInfo>

Returns all workbook and sheet-scoped defined names with scope and hidden metadata.

Parameters

includeBuiltIn System.Boolean = true optionalposition: 0
includeHidden System.Boolean = true optionalposition: 1
Load 2 overloads
public static ExcelDocument Load(String filePath, ExcelLoadOptions options = null) #
Returns: ExcelDocument

Loads an existing Excel document.

Parameters

filePath System.String requiredposition: 0
Path to the file.
options OfficeIMO.Excel.ExcelLoadOptions = null optionalposition: 1
Access, persistence, and low-level package options.

Returns

Loaded ExcelDocument instance.

public static ExcelDocument Load(Stream stream, ExcelLoadOptions options = null) #
Returns: ExcelDocument

Loads an existing Excel document from the provided stream.

Parameters

stream System.IO.Stream requiredposition: 0
Input stream containing the workbook package. Editable writable seekable sources become the associated destination; other sources remain detached.
options OfficeIMO.Excel.ExcelLoadOptions = null optionalposition: 1
Access, persistence, and low-level package options.

Returns

Loaded ExcelDocument instance.

LoadAsync 3 overloads
public static async Task<ExcelDocument> LoadAsync(String filePath, ExcelLoadOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<ExcelDocument>

Asynchronously loads an Excel document from the specified path.

Parameters

filePath System.String requiredposition: 0
Path to the Excel file.
options OfficeIMO.Excel.ExcelLoadOptions = null optionalposition: 1
Access, persistence, and low-level package options.
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
Cancellation token.

Returns

Loaded ExcelDocument instance.

Exceptions

  • FileNotFoundException โ€“ Thrown when the file does not exist.
public static async Task<ExcelDocument> LoadAsync(Stream stream, ExcelLoadOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<ExcelDocument>

Asynchronously loads an Excel document from the provided stream.

Parameters

stream System.IO.Stream requiredposition: 0
Input stream containing the workbook package. Editable writable seekable sources become the associated destination; other sources remain detached.
options OfficeIMO.Excel.ExcelLoadOptions = null optionalposition: 1
Access, persistence, and low-level package options.
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
Cancellation token.

Returns

Loaded ExcelDocument instance.

public static async Task<ExcelDocument> LoadAsync(Uri uri, ExcelHttpLoadOptions httpOptions = null, ExcelLoadOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<ExcelDocument>

Asynchronously loads an Excel workbook from a remote URI.

Parameters

uri System.Uri requiredposition: 0
HTTP or HTTPS URI of the workbook.
httpOptions OfficeIMO.Excel.ExcelHttpLoadOptions = null optionalposition: 1
Optional HTTP loading options.
options OfficeIMO.Excel.ExcelLoadOptions = null optionalposition: 2
Access, persistence, and low-level package options.
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
Cancellation token.

Returns

Loaded ExcelDocument instance.

LoadEncrypted 2 overloads
public static ExcelDocument LoadEncrypted(String filePath, String password, ExcelLoadOptions options = null) #
Returns: ExcelDocument

Loads a password-encrypted Office Open XML workbook or legacy binary `.xls` workbook.

Parameters

filePath System.String requiredposition: 0
Path to the encrypted workbook.
password System.String requiredposition: 1
Password used to decrypt the workbook package.
options OfficeIMO.Excel.ExcelLoadOptions = null optionalposition: 2
Access and load options. SaveOnDispose is not supported for encrypted sources.

Returns

Loaded ExcelDocument instance.

public static ExcelDocument LoadEncrypted(Stream stream, String password, ExcelLoadOptions options = null) #
Returns: ExcelDocument

Loads a password-encrypted Office Open XML workbook or legacy binary workbook from a stream.

Parameters

stream System.IO.Stream requiredposition: 0
Input stream containing the encrypted workbook.
password System.String requiredposition: 1
Password used to decrypt the workbook package.
options OfficeIMO.Excel.ExcelLoadOptions = null optionalposition: 2
Access and load options. SaveOnDispose is not supported for encrypted sources.

Returns

Loaded ExcelDocument instance.

LoadEncryptedAsync 2 overloads
public static async Task<ExcelDocument> LoadEncryptedAsync(String filePath, String password, ExcelLoadOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<ExcelDocument>

Asynchronously loads a password-encrypted Office Open XML workbook or legacy binary `.xls` workbook.

Parameters

filePath System.String requiredposition: 0
Path to the encrypted workbook.
password System.String requiredposition: 1
Password used to decrypt the workbook package.
options OfficeIMO.Excel.ExcelLoadOptions = null optionalposition: 2
Access and load options. SaveOnDispose is not supported for encrypted sources.
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
Cancellation token.

Returns

Loaded ExcelDocument instance.

public static async Task<ExcelDocument> LoadEncryptedAsync(Stream stream, String password, ExcelLoadOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<ExcelDocument>

Asynchronously loads a password-encrypted Office Open XML workbook or legacy binary workbook from a stream.

Parameters

stream System.IO.Stream requiredposition: 0
Input stream containing the encrypted workbook.
password System.String requiredposition: 1
Password used to decrypt the workbook package.
options OfficeIMO.Excel.ExcelLoadOptions = null optionalposition: 2
Access and load options. SaveOnDispose is not supported for encrypted sources.
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
Cancellation token.

Returns

Loaded ExcelDocument instance.

LoadLegacyXls 2 overloads
public static ExcelDocument LoadLegacyXls(String path, LegacyXlsImportOptions options = null) #
Returns: ExcelDocument

Loads a legacy binary `.xls` workbook and projects supported content into a normal OfficeIMO Excel document. The resulting document can save as Open XML `.xlsx` or as a supported native `.xls` subset.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Excel.LegacyXls.LegacyXlsImportOptions = null optionalposition: 1
public static ExcelDocument LoadLegacyXls(Stream stream, LegacyXlsImportOptions options = null) #
Returns: ExcelDocument

Loads a legacy binary `.xls` workbook stream and projects supported content into a normal OfficeIMO Excel document. The resulting document can save as Open XML `.xlsx` or as a supported native `.xls` subset.

Parameters

stream System.IO.Stream requiredposition: 0
options OfficeIMO.Excel.LegacyXls.LegacyXlsImportOptions = null optionalposition: 1
LoadLegacyXlsWithReport 2 overloads
public static LegacyXlsLoadResult LoadLegacyXlsWithReport(String path, LegacyXlsImportOptions options = null) #
Returns: LegacyXlsLoadResult

Loads a legacy binary `.xls` workbook and returns both the projected OfficeIMO document and the import report. The resulting document can save as Open XML `.xlsx` or as a supported native `.xls` subset.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Excel.LegacyXls.LegacyXlsImportOptions = null optionalposition: 1
public static LegacyXlsLoadResult LoadLegacyXlsWithReport(Stream stream, LegacyXlsImportOptions options = null) #
Returns: LegacyXlsLoadResult

Loads a legacy binary `.xls` workbook stream and returns both the projected OfficeIMO document and the import report. The resulting document can save as Open XML `.xlsx` or as a supported native `.xls` subset.

Parameters

stream System.IO.Stream requiredposition: 0
options OfficeIMO.Excel.LegacyXls.LegacyXlsImportOptions = null optionalposition: 1
public ExcelWorkbookMergeResult MergeWorkbookFrom(ExcelDocument sourceDocument, ExcelWorkbookMergeOptions options = null) #
Returns: ExcelWorkbookMergeResult

Imports selected or all worksheets from another workbook into this workbook.

Parameters

sourceDocument OfficeIMO.Excel.ExcelDocument requiredposition: 0
options OfficeIMO.Excel.ExcelWorkbookMergeOptions = null optionalposition: 1
public ExcelWorksheetMergeResult MergeWorksheets(ExcelSheet targetSheet, ExcelSheet sourceSheet, ExcelWorksheetMergeOptions options = null) #
Returns: ExcelWorksheetMergeResult

Merges source worksheet rows into a target worksheet by appending or writing to a requested target position. This is a workbook operation over worksheet values; callers own any data shaping or relational joins before writing.

Parameters

targetSheet OfficeIMO.Excel.ExcelSheet requiredposition: 0
sourceSheet OfficeIMO.Excel.ExcelSheet requiredposition: 1
options OfficeIMO.Excel.ExcelWorksheetMergeOptions = null optionalposition: 2
public static String NormalizeDefinedName(String name, ExcelDefinedNameValidationMode mode = Sanitize) #
Returns: String

Ensures a defined name complies with Excel rules. In Sanitize mode, returns a corrected name. Throws in Strict mode when input is invalid. Rules: - 1..255 characters - First char must be a letter, underscore, or backslash - Allowed characters: letters, digits, underscore, period, backslash - Cannot look like a cell reference (e.g., A1, AA10) or an R1C1 reference - Cannot be TRUE or FALSE (case-insensitive)

Parameters

name System.String requiredposition: 0
Authored workbook defined name.
mode OfficeIMO.Excel.ExcelDefinedNameValidationMode = Sanitize optionalposition: 1
Whether invalid names are sanitized or rejected.

Returns

The exact defined name that can be emitted to the workbook.

OpenDataReader 3 overloads
public static ExcelWorkbookDataReader OpenDataReader(String path, ExcelReadOptions options = null) #
Returns: ExcelWorkbookDataReader

Opens an XLSX, XLSM, XLTX, XLTM, XLAM, XLSB, or BIFF8 XLS workbook as a forward-only data reader. Worksheets are exposed in workbook order through NextResult.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 1
public static ExcelWorkbookDataReader OpenDataReader(Stream stream, ExcelReadOptions options = null) #
Returns: ExcelWorkbookDataReader

Opens an XLSX, XLSM, XLTX, XLTM, XLAM, XLSB, or BIFF8 XLS workbook stream as a forward-only data reader. The format is detected from the package rather than the file name. The input stream remains open after the returned reader is disposed.

Parameters

stream System.IO.Stream requiredposition: 0
Readable workbook stream positioned at the workbook bytes to read.
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 1
Workbook reader options.

Returns

A forward-only reader whose results follow workbook worksheet order.

public static ExcelWorkbookDataReader OpenDataReader(Byte[] bytes, ExcelReadOptions options = null) #
Returns: ExcelWorkbookDataReader

Opens an in-memory XLSX, XLSM, XLTX, XLTM, XLAM, XLSB, or BIFF8 XLS workbook as a forward-only data reader.

Parameters

bytes System.Byte[] requiredposition: 0
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 1
public static async Task<ExcelWorkbookDataReader> OpenDataReaderAsync(Uri uri, ExcelReadOptions options = null, ExcelHttpLoadOptions httpOptions = null, CancellationToken cancellationToken = null) #
Returns: Task<ExcelWorkbookDataReader>

Downloads an HTTP or HTTPS workbook and opens it as a forward-only data reader.

Parameters

uri System.Uri requiredposition: 0
options OfficeIMO.Excel.ExcelReadOptions = null optionalposition: 1
httpOptions OfficeIMO.Excel.ExcelHttpLoadOptions = null optionalposition: 2
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
public static ExcelDocument OpenFileBacked(String filePath, ExcelLoadOptions options = null, CancellationToken cancellationToken = null) #
Returns: ExcelDocument

Opens an existing Open XML workbook through a temporary file-backed package. This path avoids buffering the complete source workbook and checks cancellation while copying. It does not replace the normal optimized load path.

Parameters

filePath System.String requiredposition: 0
options OfficeIMO.Excel.ExcelLoadOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
public Void OpenInApplication(String filePath = null) #
Returns: Void

Opens the associated workbook in the operating system's registered application.

Parameters

filePath System.String = null optionalposition: 0
public Void PreflightWorkbook() #
Returns: Void

Performs a safety preflight across all worksheets to reduce the likelihood of Excel prompting for repairs on open. It removes empty containers (Hyperlinks/MergeCells), drops orphaned drawing and header/footer references, and cleans up invalid table references.

public Void ProtectWorkbook(ExcelWorkbookProtectionOptions options = null) #
Returns: Void

Protects workbook structure/window metadata. This is not file encryption.

Parameters

options OfficeIMO.Excel.ExcelWorkbookProtectionOptions = null optionalposition: 0
public Int32 RecalculateSupportedFormulas() #
Returns: Int32

Evaluates supported formulas and writes cached values.

public async Task<IReadOnlyList<ExcelQueryRefreshResult>> RefreshQueriesAsync(IExcelQueryExecutionHost host, ExcelQueryExecutionPolicy policy, CancellationToken cancellationToken = null) #
Returns: Task<IReadOnlyList<ExcelQueryRefreshResult>>

Refreshes all query-backed tables sequentially through one explicit caller host and policy.

Parameters

host OfficeIMO.Excel.IExcelQueryExecutionHost requiredposition: 0
policy OfficeIMO.Excel.ExcelQueryExecutionPolicy requiredposition: 1
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
public async Task<ExcelQueryRefreshResult> RefreshQueryAsync(String connectionOrTableName, IExcelQueryExecutionHost host, ExcelQueryExecutionPolicy policy, CancellationToken cancellationToken = null) #
Returns: Task<ExcelQueryRefreshResult>

Executes one query through an explicit caller host and atomically replaces its owned table data.

Parameters

connectionOrTableName System.String requiredposition: 0
host OfficeIMO.Excel.IExcelQueryExecutionHost requiredposition: 1
policy OfficeIMO.Excel.ExcelQueryExecutionPolicy requiredposition: 2
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
public Boolean RemoveCustomDocumentProperty(String name) #
Returns: Boolean

Removes a custom workbook property.

Parameters

name System.String requiredposition: 0
public Boolean RemoveEmbeddedPayload(String id) #
Returns: Boolean

Removes an embedded payload and known worksheet OLE/control markup that references it.

Parameters

id System.String requiredposition: 0
public Void RemoveMacros() #
Returns: Void

Removes the complete VBA project.

public Boolean RemoveNamedRange(String name, ExcelSheet scope = null, Boolean save = true) #
Returns: Boolean

Removes a defined name. If scope is provided, removes the sheetโ€‘local name; otherwise the global name.

Parameters

name System.String requiredposition: 0
Defined name to remove.
scope OfficeIMO.Excel.ExcelSheet = null optionalposition: 1
Optional sheet scope.
save System.Boolean = true optionalposition: 2
When true, saves the workbook after removal.

Returns

True if the name existed and was removed; otherwise false.

public Boolean RemoveNamedStyle(String name) #
Returns: Boolean

Removes a custom named-style catalog entry without changing already formatted cells.

Parameters

name System.String requiredposition: 0
public Boolean RemovePivotInteraction(String name, Boolean removeUnusedCache = true) #
Returns: Boolean

Removes one native slicer or timeline view and optionally its unused cache.

Parameters

name System.String requiredposition: 0
removeUnusedCache System.Boolean = true optionalposition: 1
public Boolean RemoveQueryBackedTable(String connectionOrTableName, Boolean preserveTable = true) #
Returns: Boolean

Detaches a query binding and removes its unused OfficeIMO-owned connection, optionally converting the table to a normal cell range.

Parameters

connectionOrTableName System.String requiredposition: 0
preserveTable System.Boolean = true optionalposition: 1
public Void RemoveWorksheet(String sheetName) #
Returns: Void

Removes a worksheet by name, deleting its part and entry in the workbook.

Parameters

sheetName System.String requiredposition: 0
public Boolean RenameNamedRange(String oldName, String newName, ExcelSheet scope = null, ExcelDefinedNameValidationMode validationMode = Sanitize, Boolean save = true) #
Returns: Boolean

Renames an existing workbook or sheet-scoped defined name.

Parameters

oldName System.String requiredposition: 0
newName System.String requiredposition: 1
scope OfficeIMO.Excel.ExcelSheet = null optionalposition: 2
validationMode OfficeIMO.Excel.ExcelDefinedNameValidationMode = Sanitize optionalposition: 3
save System.Boolean = true optionalposition: 4
ReorderWorksheet 2 overloads
public Void ReorderWorksheet(String sheetName, Int32 targetIndex) #
Returns: Void

Reorders a worksheet by name using a zero-based target index.

Parameters

sheetName System.String requiredposition: 0
targetIndex System.Int32 requiredposition: 1
public Void ReorderWorksheet(ExcelSheet sheet, Int32 targetIndex) #
Returns: Void

Reorders a worksheet using a zero-based target index.

Parameters

sheet OfficeIMO.Excel.ExcelSheet requiredposition: 0
targetIndex System.Int32 requiredposition: 1
public ExcelWorkbookRepairReport RepairWorkbook(ExcelWorkbookRepairOptions options = null) #
Returns: ExcelWorkbookRepairReport

Runs safe workbook repairs using OfficeIMO's existing cleanup engines, then returns before/after diagnostics.

Parameters

options OfficeIMO.Excel.ExcelWorkbookRepairOptions = null optionalposition: 0
ReplaceEmbeddedPayload 2 overloads
public Void ReplaceEmbeddedPayload(String id, Byte[] data) #
Returns: Void

Replaces an embedded payload while preserving its owner relationship.

Parameters

id System.String requiredposition: 0
data System.Byte[] requiredposition: 1
public Void ReplaceEmbeddedPayload(String id, Stream stream, Nullable<Int64> maxBytes = null) #
Returns: Void

Replaces an embedded payload from a readable stream.

Parameters

id System.String requiredposition: 0
stream System.IO.Stream requiredposition: 1
maxBytes System.Nullable{System.Int64} = null optionalposition: 2
public ExcelDocument ResetWorkbookTheme(String name = null) #
Returns: ExcelDocument

Replaces the workbook theme with the embedded default Office theme.

Parameters

name System.String = null optionalposition: 0
public String ResolveThemeColorArgb(UInt32 themeIndex, Nullable<Double> tint = null) #
Returns: String

Resolves a SpreadsheetML theme color to an ARGB hexadecimal value.

Parameters

themeIndex System.UInt32 requiredposition: 0
Zero-based SpreadsheetML theme index: light 1, dark 1, light 2, dark 2, followed by accent colors 1 through 6.
tint System.Nullable{System.Double} = null optionalposition: 1
Optional SpreadsheetML tint between -1 and 1.

Returns

An eight-character ARGB value, or null when the theme color cannot be resolved.

public ExcelWorkbookDiagnosticReport RunWorkbookDoctor(ExcelWorkbookDoctorOptions options = null) #
Returns: ExcelWorkbookDiagnosticReport

Runs workbook diagnostics and optional safe repairs for common automation hazards.

Parameters

options OfficeIMO.Excel.ExcelWorkbookDoctorOptions = null optionalposition: 0
Save 7 overloads
public Void Save(String filePath) #
Returns: Void

Saves the document without opening it.

Parameters

filePath System.String requiredposition: 0
Path to save to.
public Void Save(String filePath, ExcelSaveOptions options) #
Returns: Void

Saves the document with typed options and no positional Boolean.

Parameters

filePath System.String requiredposition: 0
Path to save to.
options OfficeIMO.Excel.ExcelSaveOptions requiredposition: 1
Optional save policy settings.
public Void Save() #
Returns: Void

Saves the document without opening it.

public Void Save(ExcelSaveOptions options) #
Returns: Void

Saves to the associated destination with optional save settings.

Parameters

options OfficeIMO.Excel.ExcelSaveOptions requiredposition: 0
public Void Save(Stream destination) #
Returns: Void

Saves the document into a writable stream as XLSX.

Parameters

destination System.IO.Stream requiredposition: 0
Writable stream that receives the Excel package content.
public Void Save(Stream destination, ExcelSaveOptions options) #
Returns: Void

Saves the document into a writable stream with optional robustness options.

Parameters

destination System.IO.Stream requiredposition: 0
Writable stream that receives the Excel package content.
options OfficeIMO.Excel.ExcelSaveOptions requiredposition: 1
Optional save behaviors (safe defined-name repair, post-save Open XML validation).
public Void Save(Stream destination, ExcelFileFormat format, ExcelSaveOptions options = null) #
Returns: Void

Saves the workbook to a stream in the explicitly selected physical format.

Parameters

destination System.IO.Stream requiredposition: 0
Writable destination stream. This one-time save does not change the associated destination.
format OfficeIMO.Excel.ExcelFileFormat requiredposition: 1
Physical XLSX, XLS, or XLSB format.
options OfficeIMO.Excel.ExcelSaveOptions = null optionalposition: 2
Optional save settings.
SaveAsImages 2 overloads
public IReadOnlyList<OfficeImageExportResult> SaveAsImages(String folderPath, ExcelWorkbookImageExportOptions options = null) #
Returns: IReadOnlyList<OfficeImageExportResult>

Saves workbook sheets as PNG files in a folder.

Parameters

folderPath System.String requiredposition: 0
options OfficeIMO.Excel.ExcelWorkbookImageExportOptions = null optionalposition: 1
public IReadOnlyList<OfficeImageExportResult> SaveAsImages(String folderPath, OfficeImageExportFormat format, ExcelWorkbookImageExportOptions options = null) #
Returns: IReadOnlyList<OfficeImageExportResult>

Saves workbook sheets as image files in a folder.

Parameters

folderPath System.String requiredposition: 0
format OfficeIMO.Drawing.OfficeImageExportFormat requiredposition: 1
options OfficeIMO.Excel.ExcelWorkbookImageExportOptions = null optionalposition: 2
SaveAsImagesAsync 2 overloads
public Task<IReadOnlyList<OfficeImageExportResult>> SaveAsImagesAsync(String folderPath, ExcelWorkbookImageExportOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<IReadOnlyList<OfficeImageExportResult>>

Asynchronously saves workbook sheets as PNG files in a folder.

Parameters

folderPath System.String requiredposition: 0
options OfficeIMO.Excel.ExcelWorkbookImageExportOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
public Task<IReadOnlyList<OfficeImageExportResult>> SaveAsImagesAsync(String folderPath, OfficeImageExportFormat format, ExcelWorkbookImageExportOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<IReadOnlyList<OfficeImageExportResult>>

Asynchronously saves workbook sheets as image files in a folder.

Parameters

folderPath System.String requiredposition: 0
format OfficeIMO.Drawing.OfficeImageExportFormat requiredposition: 1
options OfficeIMO.Excel.ExcelWorkbookImageExportOptions = null optionalposition: 2
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
SaveAsync 6 overloads
public Task SaveAsync(Stream destination, CancellationToken cancellationToken = null) #
Returns: Task

Asynchronously saves the document into a writable stream.

Parameters

destination System.IO.Stream requiredposition: 0
Writable stream that receives the Excel package content.
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
Cancels the asynchronous save work.
public Task SaveAsync(Stream destination, ExcelSaveOptions options, CancellationToken cancellationToken = null) #
Returns: Task

Asynchronously saves the document into a writable stream with optional robustness options.

Parameters

destination System.IO.Stream requiredposition: 0
Writable stream that receives the Excel package content.
options OfficeIMO.Excel.ExcelSaveOptions requiredposition: 1
Optional save behaviors (safe defined-name repair, post-save Open XML validation).
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
Cancels the asynchronous save work.
public async Task SaveAsync(Stream destination, ExcelFileFormat format, ExcelSaveOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task

Asynchronously saves the workbook to a stream in the selected physical format.

Parameters

destination System.IO.Stream requiredposition: 0
Writable destination stream.
format OfficeIMO.Excel.ExcelFileFormat requiredposition: 1
Physical XLSX or XLS format.
options OfficeIMO.Excel.ExcelSaveOptions = null optionalposition: 2
Optional save settings.
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
Cancellation token.
public Task SaveAsync(CancellationToken cancellationToken = null) #
Returns: Task

Asynchronously saves the document.

Parameters

cancellationToken System.Threading.CancellationToken = null optionalposition: 0
Cancellation token.
public Task SaveAsync(ExcelSaveOptions options, CancellationToken cancellationToken = null) #
Returns: Task

Asynchronously saves to the associated destination with optional save settings.

Parameters

options OfficeIMO.Excel.ExcelSaveOptions requiredposition: 0
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
public Task SaveAsync(String filePath, ExcelSaveOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task

Asynchronously saves to a path with optional save settings.

Parameters

filePath System.String requiredposition: 0
options OfficeIMO.Excel.ExcelSaveOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
public Void SaveCopy(String filePath, ExcelSaveOptions options = null) #
Returns: Void

Saves an independent copy without changing this workbook's associated destination.

Parameters

filePath System.String requiredposition: 0
Destination XLSX, XLSM, XLTX, XLTM, XLAM, XLS, or XLSB path.
options OfficeIMO.Excel.ExcelSaveOptions = null optionalposition: 1
Optional save policy settings.
public async Task SaveCopyAsync(String filePath, ExcelSaveOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task

Asynchronously saves an independent copy without changing this workbook's associated destination.

Parameters

filePath System.String requiredposition: 0
options OfficeIMO.Excel.ExcelSaveOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
public Void SaveEmbeddedPayload(String id, String filePath, Nullable<Int64> maxBytes = null) #
Returns: Void

Saves an embedded payload by its package-local id.

Parameters

id System.String requiredposition: 0
filePath System.String requiredposition: 1
maxBytes System.Nullable{System.Int64} = null optionalposition: 2
SaveEncrypted 2 overloads
public Void SaveEncrypted(String filePath, String password, ExcelSaveOptions saveOptions = null) #
Returns: Void

Saves the workbook as a password-encrypted Office Open XML package.

Parameters

filePath System.String requiredposition: 0
Destination path. When empty, uses the original FilePath.
password System.String requiredposition: 1
Password used to encrypt the workbook package.
saveOptions OfficeIMO.Excel.ExcelSaveOptions = null optionalposition: 2
Optional save behaviors (safe defined-name repair, post-save Open XML validation).
public Void SaveEncrypted(Stream destination, String password, ExcelSaveOptions saveOptions = null) #
Returns: Void

Saves the workbook as a password-encrypted Office Open XML package to a stream.

Parameters

destination System.IO.Stream requiredposition: 0
Writable stream that receives the encrypted workbook.
password System.String requiredposition: 1
Password used to encrypt the workbook package.
saveOptions OfficeIMO.Excel.ExcelSaveOptions = null optionalposition: 2
Optional save behaviors (safe defined-name repair, post-save Open XML validation).
public Void SaveMacros(String filePath, Nullable<Int64> maxBytes = null) #
Returns: Void

Saves the VBA project when one is present.

Parameters

filePath System.String requiredposition: 0
maxBytes System.Nullable{System.Int64} = null optionalposition: 1
public IReadOnlyList<ExcelFormulaCellInfo> SearchFormulas(ExcelFormulaSearchOptions options) #
Returns: IReadOnlyList<ExcelFormulaCellInfo>

Searches formula text, function calls, or parsed references across the workbook.

Parameters

options OfficeIMO.Excel.ExcelFormulaSearchOptions requiredposition: 0
SetActiveWorksheet 3 overloads
public Void SetActiveWorksheet(String sheetName) #
Returns: Void

Sets the worksheet that spreadsheet applications should show when the workbook opens.

Parameters

sheetName System.String requiredposition: 0
Worksheet name.
public Void SetActiveWorksheet(Int32 sheetIndex) #
Returns: Void

Sets the worksheet that spreadsheet applications should show when the workbook opens.

Parameters

sheetIndex System.Int32 requiredposition: 0
Zero-based worksheet index.
public Void SetActiveWorksheet(ExcelSheet sheet) #
Returns: Void

Sets the worksheet that spreadsheet applications should show when the workbook opens.

Parameters

sheet OfficeIMO.Excel.ExcelSheet requiredposition: 0
Worksheet to activate.
SetCustomDocumentProperty 2 overloads
public Void SetCustomDocumentProperty(String name, ExcelCustomProperty property) #
Returns: Void

Sets or replaces a custom workbook property.

Parameters

name System.String requiredposition: 0
property OfficeIMO.Excel.ExcelCustomProperty requiredposition: 1
public Void SetCustomDocumentProperty(String name, Object value) #
Returns: Void

Sets or replaces a custom workbook property, inferring the custom property type from the value.

Parameters

name System.String requiredposition: 0
value System.Object requiredposition: 1
public Void SetNamedRange(String name, String range, ExcelSheet scope = null, Boolean save = true, Boolean hidden = false, ExcelDefinedNameValidationMode validationMode = Sanitize) #
Returns: Void

Creates or updates a defined name pointing to an A1 range. When scope is provided, the name is local to that sheet; otherwise it is workbookโ€‘global.

Parameters

name System.String requiredposition: 0
Defined name to create or update.
range System.String requiredposition: 1
A1 range (e.g. "A1:B10"). Can include a sheet prefix.
scope OfficeIMO.Excel.ExcelSheet = null optionalposition: 2
Optional sheet scope for a local name.
save System.Boolean = true optionalposition: 3
When true, saves the workbook after the change.
hidden System.Boolean = false optionalposition: 4
When true, marks the defined name as hidden.
validationMode OfficeIMO.Excel.ExcelDefinedNameValidationMode = Sanitize optionalposition: 5
Controls how the name and range are validated: Sanitize (default) clamps/adjusts; Strict throws on invalid input.
public Void SetPrintArea(ExcelSheet sheet, String range, Boolean save = true) #
Returns: Void

Sets the print area for a given sheet by creating a sheet-local defined name _xlnm.Print_Area.

Parameters

sheet OfficeIMO.Excel.ExcelSheet requiredposition: 0
range System.String requiredposition: 1
save System.Boolean = true optionalposition: 2
public Void SetPrintTitles(ExcelSheet sheet, Nullable<Int32> firstRow, Nullable<Int32> lastRow, Nullable<Int32> firstCol, Nullable<Int32> lastCol, Boolean save = true) #
Returns: Void

Sets rows/columns to repeat at top/left when printing a specific sheet by creating a sheet-local defined name _xlnm.Print_Titles. Pass nulls to clear existing print titles.

Parameters

sheet OfficeIMO.Excel.ExcelSheet requiredposition: 0
Target sheet.
firstRow System.Nullable{System.Int32} requiredposition: 1
First row to repeat (1-based), or null.
lastRow System.Nullable{System.Int32} requiredposition: 2
Last row to repeat (1-based), or null.
firstCol System.Nullable{System.Int32} requiredposition: 3
First column to repeat (1-based), or null.
lastCol System.Nullable{System.Int32} requiredposition: 4
Last column to repeat (1-based), or null.
save System.Boolean = true optionalposition: 5
Whether to save the workbook after the change.
public ExcelRefreshOnOpenResult SetRefreshOnOpen(Boolean enabled = true, Boolean pivotTables = true, Boolean connections = true, Nullable<Boolean> savePivotSourceData = null) #
Returns: ExcelRefreshOnOpenResult

Enables or disables workbook refresh-on-open metadata for supported workbook data features. OfficeIMO writes the metadata request; Excel-compatible applications perform the actual refresh on open.

Parameters

enabled System.Boolean = true optionalposition: 0
Whether refresh-on-open should be enabled.
pivotTables System.Boolean = true optionalposition: 1
Update pivot cache definitions.
connections System.Boolean = true optionalposition: 2
Update workbook connection metadata parts.
savePivotSourceData System.Nullable{System.Boolean} = null optionalposition: 3
Optional pivot cache source-data setting to apply together with the refresh request.

Returns

Counts of metadata entries updated.

public ExcelDocument SetWorkbookThemeName(String name) #
Returns: ExcelDocument

Sets the workbook theme name while preserving the rest of the theme XML.

Parameters

name System.String requiredposition: 0
public ExcelDocument SetWorkbookThemeXml(String themeXml) #
Returns: ExcelDocument

Replaces or creates the workbook theme part with caller-supplied DrawingML theme XML.

Parameters

themeXml System.String requiredposition: 0
public Void SetWriteReservation(ExcelWorkbookWriteReservationOptions options = null) #
Returns: Void

Writes workbook write-reservation metadata. This is not package encryption and does not protect worksheet or workbook structure.

Parameters

options OfficeIMO.Excel.ExcelWorkbookWriteReservationOptions = null optionalposition: 0
public static OfficePackageSigningResult SignPackageSignature(String filePath, IOfficeSecurityProvider securityProvider, X509Certificate2 signingCertificate, OfficePackageSigningOptions options = null) #
Returns: OfficePackageSigningResult

Creates and validates an OPC signature in a saved XLSX/XLSM package.

Parameters

filePath System.String requiredposition: 0
securityProvider OfficeIMO.Security.IOfficeSecurityProvider requiredposition: 1
signingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2 requiredposition: 2
options OfficeIMO.Security.OfficePackageSigningOptions = null optionalposition: 3
public static OfficeVbaSigningResult SignVbaProject(String filePath, IOfficeSecurityProvider securityProvider, X509Certificate2 signingCertificate, OfficeVbaSigningOptions options = null, IEnumerable<X509Certificate2> certificateChain = null) #
Returns: OfficeVbaSigningResult

Creates and atomically validates legacy, agile, and V3 VBA signatures.

Parameters

filePath System.String requiredposition: 0
securityProvider OfficeIMO.Security.IOfficeSecurityProvider requiredposition: 1
signingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2 requiredposition: 2
options OfficeIMO.Security.OfficeVbaSigningOptions = null optionalposition: 3
certificateChain System.Collections.Generic.IEnumerable{System.Security.Cryptography.X509Certificates.X509Certificate2} = null optionalposition: 4
public Byte[] ToBytes(ExcelFileFormat format = Xlsx, ExcelSaveOptions options = null) #
Returns: Byte[]

Encodes the workbook in the selected physical format.

Parameters

format OfficeIMO.Excel.ExcelFileFormat = Xlsx optionalposition: 0
options OfficeIMO.Excel.ExcelSaveOptions = null optionalposition: 1
ToImages 2 overloads
public ExcelWorkbookImageExportBuilder ToImages() #
Returns: ExcelWorkbookImageExportBuilder

Starts a fluent image export for selected worksheets in this workbook.

public ExcelWorkbookImageExportBuilder ToImages(ExcelWorkbookImageExportOptions options) #
Returns: ExcelWorkbookImageExportBuilder

Starts a fluent batch export using a cloned options snapshot.

Parameters

options OfficeIMO.Excel.ExcelWorkbookImageExportOptions requiredposition: 0
public MemoryStream ToStream(ExcelFileFormat format = Xlsx, ExcelSaveOptions options = null) #
Returns: MemoryStream

Encodes the workbook in a new writable memory stream positioned at the beginning.

Parameters

format OfficeIMO.Excel.ExcelFileFormat = Xlsx optionalposition: 0
options OfficeIMO.Excel.ExcelSaveOptions = null optionalposition: 1
public Boolean TryGetCompatibilitySourcePayload(out OfficeCompatibilitySourcePayload payload, out String error) #
Returns: Boolean

Tries to read an original source retained by a compatibility conversion.

Parameters

payload OfficeIMO.OfficeCompatibilitySourcePayload@ requiredposition: 0
error System.String@ requiredposition: 1
public Boolean TryGetSheet(String name, out ExcelSheet sheet) #
Returns: Boolean

Tries to get a worksheet by name.

Parameters

name System.String requiredposition: 0
sheet OfficeIMO.Excel.ExcelSheet@ requiredposition: 1
public static OfficePackageSigningResult TrySignPackageSignature(String filePath, IOfficeSecurityProvider securityProvider, X509Certificate2 signingCertificate, OfficePackageSigningOptions options = null) #
Returns: OfficePackageSigningResult

Attempts OPC signature creation without throwing for an ordinary signing failure.

Parameters

filePath System.String requiredposition: 0
securityProvider OfficeIMO.Security.IOfficeSecurityProvider requiredposition: 1
signingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2 requiredposition: 2
options OfficeIMO.Security.OfficePackageSigningOptions = null optionalposition: 3
public static OfficeVbaSigningResult TrySignVbaProject(String filePath, IOfficeSecurityProvider securityProvider, X509Certificate2 signingCertificate, OfficeVbaSigningOptions options = null, IEnumerable<X509Certificate2> certificateChain = null) #
Returns: OfficeVbaSigningResult

Attempts atomic VBA signing and returns structured failure evidence.

Parameters

filePath System.String requiredposition: 0
securityProvider OfficeIMO.Security.IOfficeSecurityProvider requiredposition: 1
signingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2 requiredposition: 2
options OfficeIMO.Security.OfficeVbaSigningOptions = null optionalposition: 3
certificateChain System.Collections.Generic.IEnumerable{System.Security.Cryptography.X509Certificates.X509Certificate2} = null optionalposition: 4
public Void UnprotectWorkbook() #
Returns: Void

Removes workbook-level structure/window protection metadata.

public List<OfficeOpenXmlValidationError> ValidateDocument(OfficeOpenXmlFileFormatVersion fileFormatVersion = Microsoft365) #
Returns: List<OfficeOpenXmlValidationError>

Validates the document using the specified file format version.

Parameters

fileFormatVersion OfficeIMO.OfficeOpenXmlFileFormatVersion = Microsoft365 optionalposition: 0
File format version to validate against.

Returns

List of validation errors.

public IReadOnlyList<String> ValidateOpenXml() #
Returns: IReadOnlyList<String>

Validates the current spreadsheet with Open XML validator and returns error messages (if any). Useful for troubleshooting "Repaired Records" issues in Excel.

public static OfficePackageSignatureValidationReport ValidatePackageSignatures(String filePath, IOfficeSecurityProvider securityProvider, OfficePackageSignatureValidationOptions options = null) #
Returns: OfficePackageSignatureValidationReport

Validates a saved XLSX/XLSM package through an explicitly supplied security provider.

Parameters

filePath System.String requiredposition: 0
securityProvider OfficeIMO.Security.IOfficeSecurityProvider requiredposition: 1
options OfficeIMO.Security.OfficePackageSignatureValidationOptions = null optionalposition: 2
ValidateTemplateBindings 2 overloads
public ExcelTemplateBindingReport ValidateTemplateBindings(IDictionary<String, Object> values) #
Returns: ExcelTemplateBindingReport

Validates all workbook template markers against a dictionary of values before applying the template.

Parameters

values System.Collections.Generic.IDictionary{System.String,System.Object} requiredposition: 0
public ExcelTemplateBindingReport ValidateTemplateBindings(Object model) #
Returns: ExcelTemplateBindingReport

Validates all workbook template markers against an object model before applying the template.

Parameters

model System.Object requiredposition: 0
public static OfficeVbaSignatureValidationResult ValidateVbaSignatures(String filePath, IOfficeSecurityProvider securityProvider, OfficeVbaSignatureInspectionOptions options = null) #
Returns: OfficeVbaSignatureValidationResult

Validates VBA CMS, trust, timestamp, and Office SIP content binding.

Parameters

filePath System.String requiredposition: 0
securityProvider OfficeIMO.Security.IOfficeSecurityProvider requiredposition: 1
options OfficeIMO.Security.OfficeVbaSignatureInspectionOptions = null optionalposition: 2
public static ExcelDataSetImportResult WriteDataReader(Stream stream, IDataReader reader, ExcelTabularWriteOptions options = null, CancellationToken ct = null) #
Returns: ExcelDataSetImportResult

Writes an open data reader directly to an XLSX package without creating an editable workbook object. The caller owns the reader and its connection.

Parameters

stream System.IO.Stream requiredposition: 0
reader System.Data.IDataReader requiredposition: 1
options OfficeIMO.Excel.ExcelTabularWriteOptions = null optionalposition: 2
ct System.Threading.CancellationToken = null optionalposition: 3
public static IReadOnlyList<ExcelDataSetImportResult> WriteDataSet(Stream stream, DataSet dataSet, ExcelTableStyle tableStyle = TableStyleMedium2, Boolean includeHeaders = true, Boolean includeAutoFilter = true, CancellationToken ct = null, ExcelDateSystem dateSystem = NineteenHundred) #
Returns: IReadOnlyList<ExcelDataSetImportResult>

Writes a DataSet directly to an XLSX package, using one worksheet and one Excel table per DataTable. This path is intended for export workloads where the caller does not need to keep editing the workbook object.

Parameters

stream System.IO.Stream requiredposition: 0
dataSet System.Data.DataSet requiredposition: 1
tableStyle OfficeIMO.Excel.ExcelTableStyle = TableStyleMedium2 optionalposition: 2
includeHeaders System.Boolean = true optionalposition: 3
includeAutoFilter System.Boolean = true optionalposition: 4
ct System.Threading.CancellationToken = null optionalposition: 5
dateSystem OfficeIMO.Excel.ExcelDateSystem = NineteenHundred optionalposition: 6
public static async Task<ExcelDataSetImportResult> WriteRowsAsync<T>(Stream stream, IAsyncEnumerable<T> items, IReadOnlyList<String> headers, Action<ExcelTabularRowWriter, T> writeRow, ExcelTabularWriteOptions options = null, CancellationToken ct = null) #
Returns: Task<ExcelDataSetImportResult>

Writes an asynchronous sequence of strongly typed rows directly into an XLSX package. Rows are awaited and written one at a time without buffering the source sequence.

Type Parameters

T

Parameters

stream System.IO.Stream requiredposition: 0
items System.Collections.Generic.IAsyncEnumerable{``0} requiredposition: 1
headers System.Collections.Generic.IReadOnlyList{System.String} requiredposition: 2
writeRow System.Action{OfficeIMO.Excel.ExcelDocument.ExcelTabularRowWriter,``0} requiredposition: 3
options OfficeIMO.Excel.ExcelTabularWriteOptions = null optionalposition: 4
ct System.Threading.CancellationToken = null optionalposition: 5
public static ExcelDataSetImportResult WriteRows<T>(Stream stream, IEnumerable<T> items, IReadOnlyList<String> headers, Action<ExcelTabularRowWriter, T> writeRow, ExcelTabularWriteOptions options = null, CancellationToken ct = null) #
Returns: ExcelDataSetImportResult

Writes strongly typed rows directly into an XLSX package through a row writer. Sources are consumed once while worksheet XML is written unless table creation requires the final row range before package output begins.

Type Parameters

T

Parameters

stream System.IO.Stream requiredposition: 0
items System.Collections.Generic.IEnumerable{``0} requiredposition: 1
headers System.Collections.Generic.IReadOnlyList{System.String} requiredposition: 2
writeRow System.Action{OfficeIMO.Excel.ExcelDocument.ExcelTabularRowWriter,``0} requiredposition: 3
options OfficeIMO.Excel.ExcelTabularWriteOptions = null optionalposition: 4
ct System.Threading.CancellationToken = null optionalposition: 5

Properties

public ExcelCalculationOptions Calculation { get; } #

Formula calculation and cached-result policy used during save.

public Boolean IsWorkbookProtected { get; } #

Returns true when workbook-level structure or window protection is present.

public Boolean SheetCachingEnabled { get; set; } #

Enables caching of ExcelSheet wrappers for faster repeat access at the cost of higher memory usage. Set to false to avoid holding references to every sheet in very large workbooks.

public IEqualityComparer<String> TableNameComparer { get; set; } #

Controls how workbook-level table name uniqueness is compared. Defaults to OrdinalIgnoreCase. Changing this will reset the internal cache and rebuild it on next use. Set it once before adding tables for predictable behavior.

public ExcelChartStylePreset DefaultChartStylePreset { get; set; } #

Optional default chart style preset applied to charts created in this workbook.

public ExcelExecutionPolicy Execution { get; } #

Execution policy for controlling parallel vs sequential operations.

public Func<DateTimeOffset, DateTime> DateTimeOffsetWriteStrategy { get; set; } #

Controls how DateTimeOffset values are converted to DateTime before being written to worksheet cells. Defaults to LocalDateTime.

public IReadOnlyList<ExcelSheet> Sheets { get; } #

Gets a list of worksheets contained in the document.

public SpreadsheetDocument OpenXmlDocument { get; } #

Gets the underlying Open XML package for advanced integration scenarios.

public ExcelDateSystem DateSystem { get; set; } #

Gets or sets the workbook date system used for serialized date values.

public String FilePath { get; set; } #

Path to the file backing this document.

public ExcelBuiltinDocumentProperties BuiltinDocumentProperties { get; set; } #

Built-in (core) document properties (Title, Creator, etc.).

public ExcelApplicationProperties ApplicationProperties { get; set; } #

Extended (application) properties (Company, Manager, etc.).

public ExcelCustomDocumentPropertyCollection CustomDocumentProperties { get; } #

Custom workbook properties keyed by property name.

public FileAccess FileOpenAccess { get; } #

FileOpenAccess of the document

public DocumentAccessMode AccessMode { get; } #

Gets whether the workbook was loaded for reading or editing.

public DocumentPersistenceMode PersistenceMode { get; } #

Gets the persistence policy selected when the workbook was created or loaded.

public Boolean DocumentIsValid { get; } #

Indicates whether the document is valid.

public List<OfficeOpenXmlValidationError> DocumentValidationErrors { get; } #

Gets the list of validation errors for the document.

public Boolean UsesFileBackedPackage { get; } #

True when the editable Open XML package is staged in a bounded temporary file instead of a byte array.

public ExcelSheet this[String sheetName] { get; } #

Gets a worksheet by name (case-insensitive).

Parameters

arg1 System.String requiredposition: 0
public ExcelSheet this[Int32 sheetIndex] { get; } #

Gets a worksheet by 0-based index in workbook order.

Parameters

arg1 System.Int32 requiredposition: 0
public ExcelFileFormat SourceFormat { get; set; } #

Gets the detected physical format of the workbook source.

public OfficeFormatDescriptor SourceFormatDescriptor { get; } #

Gets the concrete source format, including modern template, add-in, macro, and XLSB variants.

public String SourcePath { get; } #

Gets the original legacy source path, or the current Open XML file association.

public IReadOnlyList<XlsbImportDiagnostic> XlsbImportDiagnostics { get; } #

Gets diagnostics produced while importing an XLSB source.

public IReadOnlyList<XlsbPreservedRecordInfo> XlsbPreservedRecords { get; } #

Gets BIFF12 records retained from the XLSB source but not projected into the normal workbook model.

public IReadOnlyList<LegacyXlsImportDiagnostic> LegacyXlsImportDiagnostics { get; } #

Gets diagnostics produced while importing a legacy binary XLS source through normal loading.

public IReadOnlyList<LegacyXlsUnsupportedFeature> LegacyXlsUnsupportedFeatures { get; } #

Gets unsupported or preserve-only legacy XLS features discovered during normal loading.

public IReadOnlyList<LegacyXlsPreservedFeatureRecord> LegacyXlsPreservedFeatures { get; } #

Gets preserve-only BIFF feature records that were not projected into the normal workbook model.

public IReadOnlyList<LegacyXlsUnsupportedSheet> LegacyXlsUnsupportedSheets { get; } #

Gets legacy XLS sheet entries that were discovered but not projected as normal worksheets.

public IReadOnlyList<LegacyXlsChartSheet> LegacyXlsChartSheets { get; } #

Gets legacy XLS chart sheets decoded during import and projected as chart-sheet package parts.

public IReadOnlyList<LegacyXlsCompoundFeatureRecord> LegacyXlsCompoundFeatures { get; } #

Gets legacy XLS compound-container features decoded during import but not projected into the normal workbook package.

public Boolean HasMacros { get; } #

Indicates whether the workbook contains a VBA project.

Fields

public const Int32 MaximumDefinedNameLength #

Maximum length supported by an Excel workbook defined name.

Value: 255

Extension Methods

public static ExcelSheet GetOrCreateSheet(ExcelDocument document, String name, ExcelSheetNameValidationMode validationMode) #
Returns: ExcelSheet

Returns the named sheet if it exists, otherwise creates it; falls back to the last sheet.

Parameters

document OfficeIMO.Excel.ExcelDocument requiredposition: 0
name System.String requiredposition: 1
validationMode OfficeIMO.Excel.ExcelSheetNameValidationMode requiredposition: 2