Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

API Reference

Class

ExcelExecutionPolicy

Namespace OfficeIMO.Excel
Assembly OfficeIMO.Excel
Modifiers sealed

Controls how eligible compute work in OfficeIMO.Excel runs (sequential vs parallel) based on workload size. Specialized single-pass readers remain eligible in every mode because bypassing a faster reader does not make an operation meaningfully more parallel. Configure global and per-operation thresholds and optionally observe the execution strategy that was actually selected.

Inheritance

  • Object
  • ExcelExecutionPolicy

Usage

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

Constructors

public ExcelExecutionPolicy() #

Creates a policy with recommended default thresholds for common operations.

Properties

public ExcelExecutionMode Mode { get; set; } #

Global execution mode. When Automatic, the policy selects sequential or parallel per operation.

public Int32 ParallelThreshold { get; set; } #

Default threshold above which Automatic permits parallel compute when no faster specialized reader applies.

public Dictionary<String, Int32> OperationThresholds { get; } #

Per-operation thresholds (names: "CellValues", "InsertObjects", "InsertObjects.PowerShellProjection", "AutoFitColumns", ...).

public Nullable<Int32> MaxDegreeOfParallelism { get; set; } #

Optional cap for parallel compute phase.

public Action<String, Int32, ExcelExecutionMode> OnDecision { get; set; } #

Structured diagnostics (operation, items, decided mode).

public Action<String, TimeSpan> OnTiming { get; set; } #

Optional timing callback invoked by long-running operations to report elapsed time. Provides a lightweight hook for performance monitoring in large workbooks. Operation names may include whole operations such as "AutoFitColumns" and scoped sub-stages such as "AutoFitColumns.BuildPlan", "AutoFitColumns.CalculateWidths", or "AutoFitColumns.ApplyWidths".

public Action<String> OnInfo { get; set; } #

Optional informational callback for verbose/debug diagnostics (no sheet output). Use to observe non-fatal events (e.g., grid overflow handled by Shrink/Summarize).

public Boolean DiagnosticsRequested { get; set; } #

Indicates whether consumers explicitly requested diagnostics. When true, operations configured with DiagnosticsOnly will run validation even if no callbacks are wired.

public ExcelWorksheetValidationMode WorksheetValidation { get; set; } #

Controls when worksheet mutation validation is executed. Defaults to running only when diagnostics are requested to avoid penalizing hot paths.

public Boolean SaveWorksheetAfterAutoFit { get; set; } #

Saves the worksheet part immediately after AutoFit mutates row heights or column widths. Disable for large report-generation pipelines that call Save or dispose the document after a batch of worksheet mutations.

public Boolean UseOpenXmlValidatorInDebug { get; set; } #

Enables invoking OpenXmlValidator while debugging. This incurs a significant cost and is ignored when not compiling in DEBUG mode.