Interrupt or Cancel the Formula Calculation of Workbook

Possible Usage Scenarios

Aspose.Cells provides a mechanism to interrupt or cancel the formula calculation of a workbook using the AbstractCalculationMonitor.Interrupt() method. This is useful when the formula calculation of a workbook is taking too much time and you want to cancel its processing.

Interrupt or Cancel the Formula Calculation of Workbook

The following sample code implements the BeforeCalculate() method of the AbstractCalculationMonitor class. Inside this method, it finds the cell name using row and column index parameters. If the cell name is B8, it interrupts the calculation process by calling the AbstractCalculationMonitor.Interrupt() method. After the concrete class derived from AbstractCalculationMonitor is implemented, its instance is assigned to the CalculationOptions.CalculationMonitor property. Finally, Workbook.CalculateFormula() is called by passing CalculationOptions as a parameter. Please see the sample Excel file used inside the code, as well as the console output of the code given below, for reference.

Sample Code

Console Output

 0----1----3----D2

0----4----6----G5

0----7----1----B8