Class AbstractFormulaChangeMonitor

Class AbstractFormulaChangeMonitor

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

Monitor for user to track the change of formulas during certain operations.

public abstract class AbstractFormulaChangeMonitor

Inheritance

objectAbstractFormulaChangeMonitor

Inherited Members

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

Examples

Workbook wb = new Workbook("template.xlsx");
InsertOptions options = new InsertOptions();
options.FormulaChangeMonitor = new MyFormulaChangeMonitor(wb.Worksheets);
wb.Worksheets[0].Cells.InsertRows(0, 2, options);

class MyFormulaChangeMonitor : AbstractFormulaChangeMonitor
{
    private readonly WorksheetCollection mWorksheets;
    public MyFormulaChangeMonitor(WorksheetCollection worksheets)
    {
        mWorksheets = worksheets;
    }
    public override void OnCellFormulaChanged(int sheetIndex, int rowIndex, int columnIndex)
    {
        Console.WriteLine("Cell " + mWorksheets[sheetIndex].Name + "!"
            + CellsHelper.CellIndexToName(rowIndex, columnIndex)
            + "'s formula was changed while inserting rows.");
    }
}

Remarks

For example, while deleting/inserting range of cells, formulas of other cells may be changed because of the shift of references. Please note, methods in the monitor may be invoked multiple times for one object which contains the formula.

Constructors

AbstractFormulaChangeMonitor()

protected AbstractFormulaChangeMonitor()

Methods

OnCellFormulaChanged(int, int, int)

The event that will be triggered when the formula in a cell is changed.

public virtual void OnCellFormulaChanged(int sheetIndex, int rowIndex, int columnIndex)

Parameters

sheetIndex int

The sheet index of the changed cell

rowIndex int

The row index of the changed cell

columnIndex int

The column index of the changed cell

OnFormatConditionFormulaChanged(FormatCondition)

The event that will be triggered when the formula of FormatCondition is changed.

public virtual void OnFormatConditionFormulaChanged(FormatCondition fc)

Parameters

fc FormatCondition

The FormatCondition object whose formula is changed

 English