DocumentOptions.CalculationMode Property
Gets or sets the calculation mode that specifies when to calculate formulas in a Workbook or Spreadsheet control.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Property Value
Type | Description |
---|---|
WorkbookCalculationMode | An enumeration member that specifies the calculation mode. The default is UseDocumentSettings for the WinForms and WPF Spreadsheet, and Manual for a Workbook component. |
Available values:
Name | Description |
---|---|
UseDocumentSettings | Uses the calculation mode specified in the document (this value is stored in the CalculationOptions.Mode property). |
Manual | Ignores the document’s calculation mode and starts calculation only on user request or after the Calculate method call. Never recalculates formulas when the document is loaded or before it is saved. |
Automatic | Ignores the document’s calculation mode and recalculates formulas each time a cell value, formula, or defined name changes. |
Property Paths
You can access this nested property as listed below:
Object Type | Path to CalculationMode |
---|---|
ISpreadsheetComponent |
|
Remarks
The CalculationMode property allows you to override the calculation mode of the loaded document (this setting is stored in the IWorkbook.DocumentSettings.Calculation.Mode property).
For instance, use Automatic mode for the Spreadsheet control if it should recalculate all dependent formulas every time a value, formula, or name referenced in these formulas changes.
Use Manual mode for a non-visual Workbook to improve document generation speed for large workbooks with multiple formulas. Call the Workbook.Calculate, Worksheet.Calculate, or CellRange.Calculate method to calculate formulas in the document.
using (Workbook workbook = new Workbook())
{
// Disable automatic calculations.
workbook.Options.CalculationMode = WorkbookCalculationMode.Manual;
// ...
// Generate the document content.
// ...
// Perform calculations if needed.
workbook.Calculate();
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CalculationMode property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.