Class AbstractFormulaChangeMonitor
Class AbstractFormulaChangeMonitor
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
监视用户在某些操作过程中跟踪公式的变化。
public abstract class AbstractFormulaChangeMonitor
继承
object ← AbstractFormulaChangeMonitor
继承成员
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
示例
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("单元格 " + mWorksheets[sheetIndex].Name + "!"
+ CellsHelper.CellIndexToName(rowIndex, columnIndex)
+ " 的公式在插入行时发生了变化。");
}
}
备注
例如,在删除/插入单元格范围时,其他单元格的公式可能会因引用的移动而发生变化。
构造函数
AbstractFormulaChangeMonitor()
protected AbstractFormulaChangeMonitor()
方法
OnCellFormulaChanged(int, int, int)
当单元格中的公式发生变化时将触发的事件。
public virtual void OnCellFormulaChanged(int sheetIndex, int rowIndex, int columnIndex)
参数
sheetIndex
int
更改单元格的工作表索引
rowIndex
int
更改单元格的行索引
columnIndex
int
更改单元格的列索引