Class AbstractFormulaChangeMonitor

Class AbstractFormulaChangeMonitor

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

Giám sát người dùng để theo dõi sự thay đổi của công thức trong quá trình thực hiện một số thao tác.

public abstract class AbstractFormulaChangeMonitor

Kế thừa

objectAbstractFormulaChangeMonitor

Thành viên kế thừa

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

Ví dụ

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("Công thức ô " + mWorksheets[sheetIndex].Name + "!"
            + CellsHelper.CellIndexToName(rowIndex, columnIndex)
            + " đã thay đổi trong khi chèn hàng.");
    }
}

Nhận xét

Ví dụ, trong khi xóa/chèn một dải ô, công thức của các ô khác có thể bị thay đổi do sự dịch chuyển của các tham chiếu.

Các hàm khởi tạo

AbstractFormulaChangeMonitor()

protected AbstractFormulaChangeMonitor()

Các phương thức

OnCellFormulaChanged(int, int, int)

Sự kiện sẽ được kích hoạt khi công thức trong một ô bị thay đổi.

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

Tham số

sheetIndex int

Chỉ số trang của ô đã thay đổi

rowIndex int

Chỉ số hàng của ô đã thay đổi

columnIndex int

Chỉ số cột của ô đã thay đổi

 Tiếng Việt