Interrupt or Cancel the Formula Calculation of Workbook

Possible Usage Scenarios

Aspose.Cells provides a mechanism to interrupt or cancel the formula calculation of the workbook using the interrupt() method of the AbstractCalculationMonitor class. This is useful when the formula calculation of 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. Once, the concrete class of AbstractCalculationMonitor class is implemented, its instance is assigned to 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 a reference.

Sample Code

Console Output

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

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

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