IWorkbook.Calculate() Method
Forces recalculation of the workbook.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Remarks
The Calculate recalculates values in cells marked for calculation. The cell is marked for calculation by the Spreadsheet control if any change is made to its formula, or when a cell range, referenced in the formula, changes.
There are also “CalculateAlways” cells which are always marked as needing recalculation. The Calculate method calculates them as well. “CalculateAlways” cell is the cell for which any of the following statements is true:
- the cell contains a volatile function (IFunction.Volatile)
- the cell references another “CalculateAlways” cell
- the cell contains a circular reference
Tip
You can create a custom calculation service implementing the ICustomCalculationService interface to change the way cells are calculated.
Tip
When the Calculate is called, all workbook modifications are applied and all cells are calculated. Recalculation of the entire workbook can take a significant amount of time and resources. To calculate only a formula contained in a single cell, use the IWorkbook.Evaluate method.
Note
This method works only if the CalculationOptions.Mode setting is CalculationMode.Manual.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Calculate() method.
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.