ExcelExecutionPolicy
OfficeIMO.Excel
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
Explore 3 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 3
- Property ExcelDocument.Execution
- Property ExcelReaderOptions.Execution
- Property ExcelSheet.ExecutionOverride
Constructors
public ExcelExecutionPolicy() #Creates a policy with recommended default thresholds for common operations.
Inherited Methods
Properties
public ExcelExecutionMode Mode { get; set; } #Global execution mode. When ExcelExecutionMode.Automatic, the policy selects sequential or parallel per operation.
public int ParallelThreshold { get; set; } #Default threshold above which Automatic permits parallel compute when no faster specialized reader applies.
public Dictionary<string, int> OperationThresholds { get; private set; } #Per-operation thresholds (names: "CellValues", "InsertObjects", "InsertObjects.PowerShellProjection", "AutoFitColumns", ...).
public int? MaxDegreeOfParallelism { get; set; } #Optional cap for parallel compute phase.
public Action<string, int, 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 bool DiagnosticsRequested { get; set; } #Indicates whether consumers explicitly requested diagnostics. When true, operations configured with ExcelWorksheetValidationMode.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 bool SaveWorksheetAfterAutoFit { get; set; } #Saves the worksheet part immediately after AutoFit mutates row heights or column widths. Disable for large report-generation pipelines that call ExcelDocument.Save or dispose the document after a batch of worksheet mutations.
public bool UseOpenXmlValidatorInDebug { get; set; } #Enables invoking OpenXmlValidator while debugging. This incurs a significant cost and is ignored when not compiling in DEBUG mode.