Class AbstractCalculationMonitor

Class AbstractCalculationMonitor

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)

Monitor for user to track the progress of formula calculation.

public abstract class AbstractCalculationMonitor

Inheritance

objectAbstractCalculationMonitor

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

csharp
[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.");
    }
}

Constructors

AbstractCalculationMonitor()

protected AbstractCalculationMonitor()

Properties

CalculatedValue

Gets the newly calculated value of the cell. Should be used only in Aspose.Cells.AbstractCalculationMonitor.AfterCalculate(System.Int32,System.Int32,System.Int32).

public object CalculatedValue { get; }

Property Value

object

OriginalValue

Gets the old value of the calculated cell. Should be used only in Aspose.Cells.AbstractCalculationMonitor.BeforeCalculate(System.Int32,System.Int32,System.Int32) and Aspose.Cells.AbstractCalculationMonitor.AfterCalculate(System.Int32,System.Int32,System.Int32).

public object OriginalValue { get; }

Property Value

object

ValueChanged

Whether the cell’s value has been changed after the calculation. Should be used only in Aspose.Cells.AbstractCalculationMonitor.AfterCalculate(System.Int32,System.Int32,System.Int32).

public bool ValueChanged { get; }

Property Value

bool

Methods

AfterCalculate(int, int, int)

Implement this method to do business after one cell has been calculated.

public virtual void AfterCalculate(int sheetIndex, int rowIndex, int colIndex)

Parameters

sheetIndex int

Index of the sheet that the cell belongs to.

rowIndex int

Row index of the cell

colIndex int

Column index of the cell

BeforeCalculate(int, int, int)

Implement this method to do business before calculating one cell.

public virtual void BeforeCalculate(int sheetIndex, int rowIndex, int colIndex)

Parameters

sheetIndex int

Index of the sheet that the cell belongs to.

rowIndex int

Row index of the cell

colIndex int

Column index of the cell

Interrupt(string)

protected void Interrupt(string msg)

Parameters

msg string

OnCircular(IEnumerator)

Implement this method to do business when calculating formulas with circular references.

public virtual bool OnCircular(IEnumerator circularCellsData)

Parameters

circularCellsData IEnumerator

IEnumerator with Aspose.Cells.CalculationCell items representing cells that depend on circular references.

Returns

bool

Whether the formula engine needs to calculate those cells in circular after this call. True to let the formula engine continue to do calculation for them. False to let the formula engine just mark those cells as Calculated.

Remarks

In the implementation user may also set the expected value as calculated result for part/all of those cells so the formula engine will not calculate them recursively.