OfficeIMO

API Reference

Class

ExecutionPolicy

Namespace OfficeIMO.Excel
Assembly OfficeIMO.Excel
Modifiers sealed

Controls how heavy operations in OfficeIMO.Excel run (sequential vs parallel) based on workload size. Configure global and per‑operation thresholds and optionally observe decisions.

Inheritance

  • Object
  • ExecutionPolicy

Constructors

public ExecutionPolicy() #

Creates a policy with recommended default thresholds for common operations.

Methods

Decide(System.String operationName, System.Int32 itemCount) #

Decide execution mode for a given operation and workload size.

Parameters

operationName System.String required
Descriptive operation name (e.g. "ReadRange", "AutoFitColumns").
itemCount System.Int32 required
Approximate number of items to process.
ReportTiming(System.String arg1, System.TimeSpan arg2) #

Helper to invoke the timing callback if configured.

Parameters

arg1 System.String required
arg2 System.TimeSpan required

Properties

public ExecutionMode 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 switches to Parallel.

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

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

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

Optional cap for parallel compute phase.

public Action<String, Int32, ExecutionMode> 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.

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 WorksheetValidationMode 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 UseOpenXmlValidatorInDebug { get; set; } #

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