Table of Contents

Class DefaultFormulaEvaluator

Namespace
OdfKit.Formula
Assembly
OdfKit.dll

Evaluates parsed ODF formulas with the default spreadsheet function set. 提供預設的 ODF 公式評估器實作。

public class DefaultFormulaEvaluator : IOdfFormulaEvaluator
Inheritance
DefaultFormulaEvaluator
Implements
Inherited Members

Constructors

DefaultFormulaEvaluator()

public DefaultFormulaEvaluator()

Methods

ClearCache()

Clears the evaluation cache and circular-dependency tracking stack. 清除評估快取與循環相依性追蹤堆疊。

public void ClearCache()

Evaluate(string, IEvaluationContext)

Evaluates a formula string and returns the result. 評估公式字串並傳回結果。

public object Evaluate(string formula, IEvaluationContext context)

Parameters

formula string

The formula string. / 公式字串。

context IEvaluationContext

The evaluation context. / 評估內容模型。

Returns

object

The formula calculation result. / 公式計算後的結果。

Remarks

Parsed syntax trees are cached by formula text, so repeated evaluation of the same formula skips tokenizing and parsing. 剖析後的語法樹會以公式字串為鍵快取,重複評估相同公式時可略過語彙分析與剖析階段。

EvaluateCell(OdfCellAddress, IEvaluationContext)

Evaluates the formula for a specific cell with circular-reference checks and caching. 評估特定儲存格的公式,並使用循環參照檢查與快取機制。

public object EvaluateCell(OdfCellAddress cellAddress, IEvaluationContext context)

Parameters

cellAddress OdfCellAddress

The cell address. / 儲存格位址。

context IEvaluationContext

The evaluation context. / 評估內容模型。

Returns

object

The evaluated cell value. / 評估後的儲存格值。

EvaluateFormulasInDocument(OdfNode)

Evaluates all document formulas under the specified content root and updates their display text and attributes. 評估指定內容根節點下的所有文件公式,並更新其顯示文字與屬性。

public void EvaluateFormulasInDocument(OdfNode contentRoot)

Parameters

contentRoot OdfNode

The document content root node. / 文件的內容根節點。

EvaluateFormulasInDocument(OdfNode, OdfExternalLinkManager?)

Evaluates all document formulas under the specified content root and resolves cross-document references through an external link manager. 評估指定內容根節點下的所有文件公式,並使用外部連結管理器解析跨文件參照。

public void EvaluateFormulasInDocument(OdfNode contentRoot, OdfExternalLinkManager? externalLinks)

Parameters

contentRoot OdfNode

The document content root node. / 文件的內容根節點。

externalLinks OdfExternalLinkManager

The external link manager. / 外部連結管理器。