Table of Contents

Class FormulaDocument

Namespace
OdfKit.Formula
Assembly
OdfKit.dll

Represents a high-level ODF formula document. 代表高階 ODF 公式文件(Formula Document)的類別。

public class FormulaDocument : OdfFormulaDocument, IDisposable, IAsyncDisposable
Inheritance
FormulaDocument
Implements
Derived
Inherited Members

Constructors

FormulaDocument(OdfPackage)

Initializes a new instance of the FormulaDocument class with the specified ODF package. 使用指定的 ODF 封裝初始化 FormulaDocument 類別的新執行個體。

public FormulaDocument(OdfPackage package)

Parameters

package OdfPackage

The ODF package instance. / ODF 封裝執行個體。

FormulaDocument(OdfPackage, string)

Initializes a new instance of the FormulaDocument class with the specified ODF package and sub-path. 使用指定的 ODF 封裝與子路徑初始化 FormulaDocument 類別的新執行個體。

public FormulaDocument(OdfPackage package, string subPath)

Parameters

package OdfPackage

The ODF package instance. / ODF 封裝執行個體。

subPath string

The sub-path within the package. / 封裝內的子路徑。

Methods

Builder()

Creates a new high-level formula document fluent builder. 建立新的高階公式文件 Fluent builder。

public static FormulaDocumentBuilder Builder()

Returns

FormulaDocumentBuilder

A new FormulaDocumentBuilder instance. / 新的 FormulaDocumentBuilder 執行個體。

Create()

Creates a new high-level formula document. 建立新的高階公式文件。

public static FormulaDocument Create()

Returns

FormulaDocument

A new FormulaDocument instance. / 新的 FormulaDocument 執行個體。

Create(string)

Creates a new high-level formula document from the specified MathML XML. 根據指定 MathML XML 建立新的高階公式文件。

public static FormulaDocument Create(string mathml)

Parameters

mathml string

The well-formed MathML XML. / 格式正確的 MathML XML。

Returns

FormulaDocument

The created high-level FormulaDocument instance. / 建立完成的高階 FormulaDocument 執行個體。

Exceptions

ArgumentNullException

When mathml is null. / 當 mathmlnull 時擲出。

CreateFromFlatDocument(FlatFormulaDocument)

Creates an equivalent ODF (ZIP package) formula document from an FDF flat XML formula document, preserving the same content. 從 FDF 扁平 XML 公式文件建立等價的 ODF(ZIP 封裝)公式文件,內容完全相同。

public static FormulaDocument CreateFromFlatDocument(FlatFormulaDocument document)

Parameters

document FlatFormulaDocument

The source FDF flat XML formula document. / 來源 FDF 扁平 XML 公式文件。

Returns

FormulaDocument

The created FormulaDocument instance. / 建立完成的 FormulaDocument 執行個體。

CreateFromTemplate(FormulaTemplateDocument)

Creates a new high-level formula document from the specified formula template document. 從指定的公式範本文件建立新的高階公式文件。

public static FormulaDocument CreateFromTemplate(FormulaTemplateDocument template)

Parameters

template FormulaTemplateDocument

The formula template document. / 公式範本文件。

Returns

FormulaDocument

The created FormulaDocument instance. / 建立完成的 FormulaDocument 執行個體。

FromBuilder(Action<OdfMathBuilder>)

Creates and loads a high-level formula document by using an OdfMathBuilder composition delegate. 使用 OdfMathBuilder 組合委派建立並載入高階公式文件。

public static FormulaDocument FromBuilder(Action<OdfMathBuilder> build)

Parameters

build Action<OdfMathBuilder>

The delegate used to compose the MathML token tree. / 用於組合 MathML token 樹狀結構的委派。

Returns

FormulaDocument

The FormulaDocument instance loaded with the composed result. / 已載入組合結果的 FormulaDocument 執行個體。

Exceptions

ArgumentNullException

When build is null. / 當 buildnull 時擲出。

FromLatex(string)

Creates and loads a high-level formula document from the specified LaTeX formula string. 從指定的 LaTeX 公式字串建立並載入高階公式文件。

public static FormulaDocument FromLatex(string latex)

Parameters

latex string

The LaTeX formula string. / LaTeX 公式字串。

Returns

FormulaDocument

The FormulaDocument instance loaded with the LaTeX formula. / 已載入 LaTeX 公式的 FormulaDocument 執行個體。

Exceptions

ArgumentNullException

When latex is null. / 當 latexnull 時擲出。

ArgumentException

When the LaTeX formula syntax is invalid. / 當 LaTeX 公式語法錯誤時擲出。

Load(Stream)

Loads a high-level formula document from the specified stream. 從指定資料流載入高階公式文件。

public static FormulaDocument Load(Stream stream)

Parameters

stream Stream

Returns

FormulaDocument

The loaded high-level FormulaDocument instance. / 載入完成的高階 FormulaDocument 執行個體。

Load(Stream, string?)

Full overload of Load that accepts stream and fileName. Load 完整多載:接受 stream 與 fileName。

public static FormulaDocument Load(Stream stream, string? fileName)

Parameters

stream Stream
fileName string

Returns

FormulaDocument

Load(string)

Loads a high-level formula document from the specified file path. 從指定檔案路徑載入高階公式文件。

public static FormulaDocument Load(string path)

Parameters

path string

The ODF formula document path. / ODF 公式文件路徑。

Returns

FormulaDocument

The loaded high-level FormulaDocument instance. / 載入完成的高階 FormulaDocument 執行個體。

LoadAsync(Stream)

Asynchronously loads a high-level formula document from the specified stream. 非同步從指定資料流載入高階公式文件。

public static Task<FormulaDocument> LoadAsync(Stream stream)

Parameters

stream Stream

Returns

Task<FormulaDocument>

A task representing the asynchronous load operation, whose result is the loaded high-level FormulaDocument. / 代表非同步載入作業的工作,其結果為載入完成的高階 FormulaDocument

LoadAsync(Stream, string?)

Short overload of LoadAsync that accepts stream and fileName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream 與 fileName;其餘可選參數使用預設值並轉呼叫最長 LoadAsync 多載。

public static Task<FormulaDocument> LoadAsync(Stream stream, string? fileName)

Parameters

stream Stream
fileName string

Returns

Task<FormulaDocument>

LoadAsync(Stream, string?, CancellationToken)

Short overload of LoadAsync that accepts stream, fileName, and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream、fileName 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 LoadAsync 多載。

public static Task<FormulaDocument> LoadAsync(Stream stream, string? fileName, CancellationToken cancellationToken)

Parameters

stream Stream
fileName string
cancellationToken CancellationToken

Returns

Task<FormulaDocument>

LoadAsync(Stream, CancellationToken)

Asynchronously loads the document from a stream with a cancellation token. 以取消語彙基元非同步從資料流載入文件。

public static Task<FormulaDocument> LoadAsync(Stream stream, CancellationToken cancellationToken)

Parameters

stream Stream

The document stream. / 文件資料流。

cancellationToken CancellationToken

The cancellation token. / 取消語彙基元。

Returns

Task<FormulaDocument>

A task whose result is the loaded document. / 代表非同步載入作業的工作,其結果為載入完成的文件。

LoadAsync(string)

Asynchronously loads a high-level formula document from the specified file path. 非同步從指定檔案路徑載入高階公式文件。

public static Task<FormulaDocument> LoadAsync(string path)

Parameters

path string

Returns

Task<FormulaDocument>

A task representing the asynchronous load operation, whose result is the loaded high-level FormulaDocument. / 代表非同步載入作業的工作,其結果為載入完成的高階 FormulaDocument

LoadAsync(string, CancellationToken)

Short overload of LoadAsync that accepts path and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 path 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 LoadAsync 多載。

public static Task<FormulaDocument> LoadAsync(string path, CancellationToken cancellationToken)

Parameters

path string
cancellationToken CancellationToken

Returns

Task<FormulaDocument>

SetMathML(string)

Sets the MathML XML string. 設定 MathML 的 XML 字串。

public void SetMathML(string mathml)

Parameters

mathml string

The well-formed MathML XML. / 格式正確的 MathML XML。