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#]
//Custom monitor to check possibility of StackOverflowException
public class MyCalculationMonitor : AbstractCalculationMonitor
{
    public override void BeforeCalculate(int sheetIndex, int rowIndex, int colIndex)
    {
        if(new StackTrace(false).FrameCount > 1000)
        {
            throw new Exception("Stop the formula calculation because risk of StackOverflowException");
        }
    }
}

See Also