AbstractCalculationMonitor

AbstractCalculationMonitor class

Monitor for user to track the progress of formula calculation.

public abstract class AbstractCalculationMonitor

Properties

Name Description
CalculatedValue { get; } Gets the newly calculated value of the cell. Should be used only in AfterCalculate.
OriginalValue { get; } Gets the old value of the calculated cell. Should be used only in BeforeCalculate and AfterCalculate.
ValueChanged { get; } Whether the cell’s value has been changed after the calculation. Should be used only in AfterCalculate.

Methods

Name Description
virtual AfterCalculate(int, int, int) Implement this method to do business after one cell has been calculated.
virtual BeforeCalculate(int, int, int) Implement this method to do business before calculating one cell.
virtual OnCircular(IEnumerator) Implement this method to do business when calculating formulas with circular references.

Examples

[C#]
Workbook wb = new Workbook("calc.xlsx");
CalculationOptions opts = new CalculationOptions();
opts.CalculationMonitor = new MyCalculationMonitor();
wb.CalculateFormula(opts);

class MyCalculationMonitor : AbstractCalculationMonitor
{
    public override void BeforeCalculate(int sheetIndex, int rowIndex, int colIndex)
    {
        if(sheetIndex!=0 || rowIndex!=0 || colIndex!=0)
        {
            return;
        }
        Console.WriteLine("Cell A1 will be calculated.");
    }
}

See Also