Class AbstractCalculationMonitor
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
监视用户以跟踪公式计算的进度。
public abstract class AbstractCalculationMonitor
继承
object ← AbstractCalculationMonitor
继承成员
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
示例
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("单元格 A1 将被计算。");
}
}
构造函数
AbstractCalculationMonitor()
protected AbstractCalculationMonitor()
属性
CalculatedValue
获取单元格的新计算值。 应仅在 Aspose.Cells.AbstractCalculationMonitor.AfterCalculate(System.Int32,System.Int32,System.Int32) 中使用。
public object CalculatedValue { get; }
属性值
OriginalValue
获取计算单元格的旧值。 应仅在 Aspose.Cells.AbstractCalculationMonitor.BeforeCalculate(System.Int32,System.Int32,System.Int32) 和 Aspose.Cells.AbstractCalculationMonitor.AfterCalculate(System.Int32,System.Int32,System.Int32) 中使用。
public object OriginalValue { get; }
属性值
ValueChanged
计算后单元格的值是否已更改。 应仅在 Aspose.Cells.AbstractCalculationMonitor.AfterCalculate(System.Int32,System.Int32,System.Int32) 中使用。
public bool ValueChanged { get; }
属性值
方法
AfterCalculate(int, int, int)
实现此方法以在一个单元格计算后进行处理。
public virtual void AfterCalculate(int sheetIndex, int rowIndex, int colIndex)
参数
sheetIndex
int
单元格所属工作表的索引。
rowIndex
int
单元格的行索引
colIndex
int
单元格的列索引
BeforeCalculate(int, int, int)
实现此方法以在计算一个单元格之前进行处理。
public virtual void BeforeCalculate(int sheetIndex, int rowIndex, int colIndex)
参数
sheetIndex
int
单元格所属工作表的索引。
rowIndex
int
单元格的行索引
colIndex
int
单元格的列索引
Interrupt(string)
protected void Interrupt(string msg)
参数
msg
string
OnCircular(IEnumerator)
实现此方法以在计算具有循环引用的公式时进行处理。
public virtual bool OnCircular(IEnumerator circularCellsData)
参数
circularCellsData
IEnumerator
包含 Aspose.Cells.CalculationCell 项的 IEnumerator,表示依赖于循环引用的单元格。
返回
公式引擎是否需要在此调用后计算这些循环单元格。 如果为真,则让公式引擎继续计算它们。 如果为假,则让公式引擎仅将这些单元格标记为已计算。
备注
在实现中,用户还可以将期望值设置为部分/全部这些单元格的计算结果,以便公式引擎不会递归地计算它们。