Table of Contents

Class OdfDocument

Namespace
OdfKit.Core
Assembly
OdfKit.dll

Wires shared collaborators used by core document persistence operations. 串接核心文件持久化作業使用的共用協作者。

public abstract class OdfDocument : IDisposable, IAsyncDisposable
Inheritance
OdfDocument
Implements
Derived
Inherited Members

Constructors

OdfDocument(OdfPackage)

Initializes a new instance of the OdfDocument class. 初始化 OdfDocument 類別的新執行個體。

protected OdfDocument(OdfPackage package)

Parameters

package OdfPackage

The OdfPackage container. / OdfPackage 封裝容器。

OdfDocument(OdfPackage, string)

Initializes a new instance of the OdfDocument class with the specified sub-path. 初始化指定子路徑的 OdfDocument 類別的新執行個體。

protected OdfDocument(OdfPackage package, string subPath)

Parameters

package OdfPackage

The OdfPackage container. / OdfPackage 封裝容器。

subPath string

The sub-path of the embedded document within the package. / 嵌入式文件在封裝中的子路徑。

Properties

AutoCalculate

Gets or sets a value indicating whether spreadsheet formulas are recalculated automatically. 取得或設定是否自動重新計算試算表公式。

public bool AutoCalculate { get; set; }

Property Value

bool

Bookmarks

Gets the bookmark manager, providing a high-level interface for safely reading, writing, and manipulating bookmarks. 取得書籤管理器,提供安全讀寫與操作書籤的高階介面。

public OdfBookmarkManager Bookmarks { get; }

Property Value

OdfBookmarkManager

ContentKind

Gets the content kind used by the current document under office:body. 取得目前文件在 office:body 下使用的內容種類。

public OdfDocumentKind ContentKind { get; }

Property Value

OdfDocumentKind

CreationDate

Gets or sets the document creation timestamp. 取得或設定文件建立日期。

public DateTime? CreationDate { get; set; }

Property Value

DateTime?

Creator

Gets or sets the document creator. 取得或設定文件建立者。

public string? Creator { get; set; }

Property Value

string

Description

Gets or sets the document description. 取得或設定文件描述。

public string? Description { get; set; }

Property Value

string

DocumentKind

Gets the ODF document kind declared by the current package's MIME type. 取得目前封裝 MIME 類型所宣告的 ODF 文件種類。

public OdfDocumentKind DocumentKind { get; }

Property Value

OdfDocumentKind

Format

Gets the format description corresponding to the current document kind; null if the MIME type is not recognized. 取得目前文件種類對應的格式描述;若 MIME 類型無法辨識則為 null

public OdfFormatInfo? Format { get; }

Property Value

OdfFormatInfo

IsFlatXml

Gets a value indicating whether the current document is a single-file (Flat XML) ODF format. 取得一個值,指出目前文件是否為單一 XML (Flat XML) ODF 格式。

public bool IsFlatXml { get; }

Property Value

bool

IsMasterDocument

Gets a value indicating whether the current document is an ODF master document format. 取得一個值,指出目前文件是否為 ODF 主控文件格式。

public bool IsMasterDocument { get; }

Property Value

bool

IsTemplate

Gets a value indicating whether the current document is an ODF template format. 取得一個值,指出目前文件是否為 ODF 範本格式。

public bool IsTemplate { get; }

Property Value

bool

IsUpdateActive

Provides the IsUpdateActive member. 取得目前文件是否位於批次更新範圍內。

public bool IsUpdateActive { get; }

Property Value

bool

Language

Gets or sets the document language tag. 取得或設定文件語言。

public string? Language { get; set; }

Property Value

string

LinkUpdateMode

Gets or sets the external link update mode stored in document settings. 取得或設定文件設定中儲存的外部連結更新模式。

public int LinkUpdateMode { get; set; }

Property Value

int

ModificationDate

Gets or sets the document modification timestamp. 取得或設定文件修改日期。

public DateTime? ModificationDate { get; set; }

Property Value

DateTime?

Package

Gets the ODF package container associated with this document. 取得與此文件相關聯的 ODF 封裝容器。

public OdfPackage Package { get; }

Property Value

OdfPackage

Styles

Gets the document's style engine, usable for style property lookup, deduplication, and unused style reclamation. 取得文件樣式引擎,可用於樣式屬性查詢、去重與未使用樣式回收。

public OdfStyleEngine Styles { get; }

Property Value

OdfStyleEngine

SubPath

Gets or sets the path of an embedded document within the package container. Empty for a root document. 取得或設定嵌入式文件在封裝容器內的路徑。若為根文件則為空字串。

public string SubPath { get; set; }

Property Value

string

Subject

Gets or sets the document subject. 取得或設定文件主旨。

public string? Subject { get; set; }

Property Value

string

TargetVersion

Gets or sets the ODF version to declare when the document is saved. 取得或設定文件儲存時要宣告的目標 ODF 版本。

public OdfVersion? TargetVersion { get; set; }

Property Value

OdfVersion?

TemplateMetadata

Gets or sets metadata describing the source template. 取得或設定文件來源範本中繼資料。

public OdfTemplateMetadata? TemplateMetadata { get; set; }

Property Value

OdfTemplateMetadata

Title

Gets or sets the document title. 取得或設定文件標題。

public string? Title { get; set; }

Property Value

string

ZoomLevel

Gets or sets the document view zoom percentage. 取得或設定文件檢視縮放百分比。

public double ZoomLevel { get; set; }

Property Value

double

Methods

AddMasterPage(string)

Adds master page. 新增一個指定名稱的主控頁面(Master Page)。

public OdfMasterPage AddMasterPage(string name)

Parameters

name string

主控頁面的名稱

Returns

OdfMasterPage

新增的主控頁面執行個體

AdoptNode(OdfDocument, OdfNode)

Performs adopt node. 採納來源文件中的節點至目前文件,將其與原父節點脫鉤,並轉移其所有權至目前文件。

public virtual OdfNode AdoptNode(OdfDocument sourceDocument, OdfNode node)

Parameters

sourceDocument OdfDocument

來源文件

node OdfNode

要採納的來源節點

Returns

OdfNode

已完成採納的節點實體(與原 Parent 脫鉤,且 Document 屬性已更新)

Remarks

此方法實作了 O(1) 零拷貝節點轉移。來源文件資訊用於跨文件媒體參照移轉,避免嵌入圖片或物件在採納後失聯。

AdoptNode(OdfNode)

Performs adopt node. 採納來源節點至目前文件,將其與原父節點脫鉤,並轉移其所有權至目前文件。

public virtual OdfNode AdoptNode(OdfNode node)

Parameters

node OdfNode

要採納的來源節點

Returns

OdfNode

已完成採納的節點實體(與原 Parent 脫鉤,且 Document 屬性已更新)

Remarks

此方法實作了 O(1) 零拷貝節點轉移。當來源節點來自另一份文件時, 會自動處理必要的媒體參照移轉與命名空間補全。

AppendDocument(OdfDocument)

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

public virtual void AppendDocument(OdfDocument otherDoc)

Parameters

otherDoc OdfDocument

AppendDocument(OdfDocument, OdfMergeOptions?)

Appends document. 將另一份 ODF 文件附加到目前文件。

public virtual void AppendDocument(OdfDocument otherDoc, OdfMergeOptions? options)

Parameters

otherDoc OdfDocument

要附加的來源文件

options OdfMergeOptions

合併選項

BeginUpdate()

Performs begin update. 開始批次更新範圍,暫緩樣式重對照與自動樣式去重,直到最外層範圍結束。

public IDisposable BeginUpdate()

Returns

IDisposable

可釋放的批次更新範圍;建議搭配 using 使用

Remarks

批次更新範圍支援巢狀呼叫。只有最外層 EndUpdate() 或範圍釋放時,才會重新整理延後的樣式變更。

ClearParagraphTextContentRecursive(OdfNode)

Clears paragraph text content recursive. 遞迴清除指定節點底下所有 text:ptext:span 段落的文字內容,但保留節點結構

protected static void ClearParagraphTextContentRecursive(OdfNode node)

Parameters

node OdfNode

要清除文字內容的根節點

ClearTemplateUserContent()

Clears template user content. 清除範本實例化後的使用者內容,但保留格式與版面配置。

protected virtual void ClearTemplateUserContent()

Remarks

基底實作不做任何事;各文件種類(文字、試算表、簡報、繪圖)於對應的部分類別中覆寫, 依各自的內容模型清除使用者資料。

ConvertFlatXmlToZip(string, string)

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

public static void ConvertFlatXmlToZip(string sourcePath, string destinationPath)

Parameters

sourcePath string
destinationPath string

ConvertFlatXmlToZip(string, string, OdfLoadOptions?)

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

public static void ConvertFlatXmlToZip(string sourcePath, string destinationPath, OdfLoadOptions? loadOptions)

Parameters

sourcePath string
destinationPath string
loadOptions OdfLoadOptions

ConvertFlatXmlToZip(string, string, OdfLoadOptions?, OdfSaveOptions?)

Converts flat xml to zip. 將 Flat XML 格式的 ODF 文件就地轉換為一般 ZIP 封裝格式。

public static void ConvertFlatXmlToZip(string sourcePath, string destinationPath, OdfLoadOptions? loadOptions, OdfSaveOptions? saveOptions)

Parameters

sourcePath string

來源 Flat XML 文件路徑

destinationPath string

目標 ZIP 封裝文件路徑

loadOptions OdfLoadOptions

載入選項;若為 null,則使用預設選項

saveOptions OdfSaveOptions

儲存設定選項;若為 null,則使用預設選項

ConvertZipToFlatXml(string, string)

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

public static void ConvertZipToFlatXml(string sourcePath, string destinationPath)

Parameters

sourcePath string
destinationPath string

ConvertZipToFlatXml(string, string, OdfLoadOptions?)

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

public static void ConvertZipToFlatXml(string sourcePath, string destinationPath, OdfLoadOptions? loadOptions)

Parameters

sourcePath string
destinationPath string
loadOptions OdfLoadOptions

ConvertZipToFlatXml(string, string, OdfLoadOptions?, OdfSaveOptions?)

Converts zip to flat xml. 將一般 ZIP 封裝的 ODF 文件就地轉換為 Flat XML 格式。

public static void ConvertZipToFlatXml(string sourcePath, string destinationPath, OdfLoadOptions? loadOptions, OdfSaveOptions? saveOptions)

Parameters

sourcePath string

來源 ZIP 封裝文件路徑

destinationPath string

目標 Flat XML 文件路徑

loadOptions OdfLoadOptions

載入選項;若為 null,則使用預設選項

saveOptions OdfSaveOptions

儲存設定選項;若為 null,則使用預設選項

Create(OdfDocumentKind)

Creates an ODF document of the specified kind. 建立指定種類的 ODF 文件。

public static OdfDocument Create(OdfDocumentKind kind)

Parameters

kind OdfDocumentKind

The ODF document kind to create. / 要建立的 ODF 文件種類。

Returns

OdfDocument

The created ODF document. / 建立完成的 ODF 文件。

CreateEmbeddedDocument<T>(string)

Creates a new embedded ODF document at the specified package subpath. 在指定封裝子路徑建立新的嵌入式 ODF 文件。

public T CreateEmbeddedDocument<T>(string subPath) where T : OdfDocument

Parameters

subPath string

The package subpath where the embedded document is created. / 建立嵌入式文件的封裝子路徑。

Returns

T

The created embedded document wrapper. / 建立完成的嵌入式文件包裝器。

Type Parameters

T

The embedded document wrapper type. / 嵌入式文件包裝器型別。

Remarks

此方法會在建立時立即呼叫一次傳回文件的 Save() 以寫入最小骨架內容; 後續透過傳回 wrapper 所做的修改會由父文件 Save(OdfSaveOptions?)SaveToStream(Stream, OdfSaveOptions?) 與非同步儲存流程自動 flush 至封裝。 呼叫端仍可手動呼叫嵌入式文件的 Save() 以提早寫回。

Dispose()

Releases the document and underlying package resources. 釋放文件與底層封裝資源。

public void Dispose()

Dispose(bool)

Releases the resources held by the document. 釋放文件持有的資源。

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

If true, managed resources are released. / 若為 true,則釋放受控資源。

DisposeAsync()

Asynchronously releases the document and underlying package resources. 非同步釋放文件與底層封裝資源。

public ValueTask DisposeAsync()

Returns

ValueTask

A value task representing the asynchronous release operation. / 代表非同步釋放作業的值工作。

EndUpdate()

Performs end update. 結束目前批次更新範圍,並在離開最外層範圍時重新整理延後的樣式變更。

public void EndUpdate()

Exceptions

InvalidOperationException

當未先呼叫 BeginUpdate() 時擲出

ExportToPdf(Stream)

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

public void ExportToPdf(Stream pdfStream)

Parameters

pdfStream Stream

ExportToPdf(Stream, X509Certificate2?)

Converts and exports the current document to PDF format. 將目前文件轉換並匯出為 PDF 格式。

public void ExportToPdf(Stream pdfStream, X509Certificate2? certificate)

Parameters

pdfStream Stream

The target stream to which the PDF is written. / 要寫入 PDF 的目標資料流。

certificate X509Certificate2

The certificate used to sign the PDF; if null, the PDF is not signed. / 用於簽章 PDF 的憑證;若為 null 則不簽章。

FindCustomProperty(string)

Finds the custom metadata property. 尋找自訂中繼資料屬性。

public object? FindCustomProperty(string name)

Parameters

name string

The custom property name. / 自訂屬性名稱。

Returns

object

The property value, or null when it does not exist. / 屬性值;若不存在則為 null

FindCustomProperty<T>(string)

Finds and converts the custom metadata property to the specified type. 尋找自訂中繼資料屬性,並轉換成指定型別。

public T? FindCustomProperty<T>(string name)

Parameters

name string

The custom property name. / 自訂屬性名稱。

Returns

T

The converted property value, or the default value when missing or conversion fails. / 轉換後的屬性值;若不存在或轉換失敗則為預設值。

Type Parameters

T

The target value type. / 目標值型別。

FindOrCreateChild(OdfNode, string, string, string)

Finds or create child. 尋找或建立指定子元素。

protected OdfNode FindOrCreateChild(OdfNode parent, string localName, string ns, string prefix)

Parameters

parent OdfNode

父節點

localName string

子元素區域名稱

ns string

子元素命名空間 URI

prefix string

子元素前綴

Returns

OdfNode

符合條件的既有或新建子元素

FindOrCreateConfigItemNode(OdfNode, string, string)

Finds or create config item node. 尋找或建立設定專案節點。

protected OdfNode FindOrCreateConfigItemNode(OdfNode entryNode, string name, string type)

Parameters

entryNode OdfNode

設定 map entry 節點

name string

設定專案名稱

type string

設定專案類型

Returns

OdfNode

設定專案節點

FindOrCreateMapEntryNode(OdfNode)

Finds or create map entry node. 尋找或建立設定 map entry 節點。

protected OdfNode FindOrCreateMapEntryNode(OdfNode mapNode)

Parameters

mapNode OdfNode

設定 map 節點

Returns

OdfNode

設定 map entry 節點

FindOrCreateMapNode(OdfNode, string)

Finds or create map node. 尋找或建立設定 map 節點。

protected OdfNode FindOrCreateMapNode(OdfNode setNode, string name)

Parameters

setNode OdfNode

設定集合節點

name string

map 名稱

Returns

OdfNode

設定 map 節點

FindOrCreateMetaRoot()

Finds or create meta root. 尋找或建立 office:meta 根節點。

protected OdfNode FindOrCreateMetaRoot()

Returns

OdfNode

office:meta 節點

FindOrCreateSettingsNode(OdfNode, string)

Finds or create settings node. 尋找或建立指定名稱的設定集合節點。

protected OdfNode FindOrCreateSettingsNode(OdfNode root, string name)

Parameters

root OdfNode

設定 DOM 根節點

name string

設定集合名稱

Returns

OdfNode

設定集合節點

FindSettingsConfigItem(string)

Finds settings config item. 尋找指定名稱的設定專案。

protected OdfNode? FindSettingsConfigItem(string name)

Parameters

name string

設定專案名稱

Returns

OdfNode

設定專案節點;若不存在則為 null

FindSettingsNode(OdfNode, string)

Finds settings node. 尋找指定名稱的設定集合節點。

protected OdfNode? FindSettingsNode(OdfNode root, string name)

Parameters

root OdfNode

設定 DOM 根節點

name string

設定集合名稱

Returns

OdfNode

設定集合節點;若不存在則為 null

GetAllCustomProperties()

Gets all custom metadata properties. 取得所有自訂中繼資料屬性的字典。

public IReadOnlyDictionary<string, object?> GetAllCustomProperties()

Returns

IReadOnlyDictionary<string, object>

A read-only dictionary keyed by property name. / 以屬性名稱為鍵的唯讀字典。

GetDefaultContentXml()

Gets the default content.xml for this document kind. 取得此文件類型的預設 content.xml。

protected abstract string GetDefaultContentXml()

Returns

string

The default content.xml string. / 預設 content.xml 字串。

GetDefaultMetaXml()

Gets the default meta.xml for this document kind. 取得此文件類型的預設 meta.xml。

protected virtual string GetDefaultMetaXml()

Returns

string

The default meta.xml string. / 預設 meta.xml 字串。

GetDefaultSettingsXml()

Gets the default settings.xml for this document kind. 取得此文件類型的預設 settings.xml。

protected virtual string GetDefaultSettingsXml()

Returns

string

The default settings.xml string. / 預設 settings.xml 字串。

GetDefaultStylesXml()

Gets the default styles.xml for this document kind. 取得此文件類型的預設 styles.xml。

protected abstract string GetDefaultStylesXml()

Returns

string

The default styles.xml string. / 預設 styles.xml 字串。

GetEmbeddedDocument<T>(string)

Gets an embedded ODF document wrapper for the specified package subpath. 取得指定封裝子路徑的嵌入式 ODF 文件包裝器。

public T GetEmbeddedDocument<T>(string subPath) where T : OdfDocument

Parameters

subPath string

The package subpath that contains the embedded document. / 包含嵌入式文件的封裝子路徑。

Returns

T

The embedded document wrapper. / 嵌入式文件包裝器。

Type Parameters

T

The embedded document wrapper type. / 嵌入式文件包裝器型別。

GetMasterPages()

Gets master pages. 取得文件中所有的主控頁面(Master Page)。

public IEnumerable<OdfMasterPage> GetMasterPages()

Returns

IEnumerable<OdfMasterPage>

主控頁面集合

GetSignatureSummary()

Gets signature summary. 取得文件封裝內數位簽章專案的摘要狀態。

public OdfDocumentSignatureSummary GetSignatureSummary()

Returns

OdfDocumentSignatureSummary

描述簽章專案存在狀態、可讀性與簽章數量的摘要

Load(Stream)

Loads an ODF document from the specified stream. 從指定資料流載入 ODF 文件。

public static OdfDocument Load(Stream stream)

Parameters

stream Stream

Returns

OdfDocument

The loaded ODF document. / 載入完成的 ODF 文件。

Load(Stream, OdfLoadOptions?)

Loads an ODF document from the specified stream and load options. 從指定資料流與載入選項載入 ODF 文件。

public static OdfDocument Load(Stream stream, OdfLoadOptions? options)

Parameters

stream Stream
options OdfLoadOptions

Returns

OdfDocument

The loaded ODF document. / 載入完成的 ODF 文件。

Load(Stream, OdfLoadOptions?, string?)

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

public static OdfDocument Load(Stream stream, OdfLoadOptions? options, string? fileName)

Parameters

stream Stream
options OdfLoadOptions
fileName string

Returns

OdfDocument

Load(Stream, string?)

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

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

Parameters

stream Stream
fileName string

Returns

OdfDocument

Load(string)

Loads an ODF document from the specified path. 從指定路徑載入 ODF 文件。

public static OdfDocument Load(string path)

Parameters

path string

The ODF document path. / ODF 文件路徑。

Returns

OdfDocument

The loaded ODF document. / 載入完成的 ODF 文件。

Remarks

在 ASP.NET Core 等伺服器環境中,請優先使用 LoadAsync(string, CancellationToken) 以避免阻塞執行緒

Load(string, OdfLoadOptions?)

Loads an ODF document from the specified path and load options. 從指定路徑與載入選項載入 ODF 文件。

public static OdfDocument Load(string path, OdfLoadOptions? options)

Parameters

path string

The ODF document path. / ODF 文件路徑。

options OdfLoadOptions

The load options, such as a password for encrypted documents and security limits. / 載入選項,例如加密文件密碼與安全限制。

Returns

OdfDocument

The loaded ODF document. / 載入完成的 ODF 文件。

LoadAsync(Stream)

Asynchronously loads an ODF document from the specified stream. 非同步從指定資料流載入 ODF 文件。

public static Task<OdfDocument> LoadAsync(Stream stream)

Parameters

stream Stream

Returns

Task<OdfDocument>

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

Remarks

若 已請求取消,作業會立即以 OperationCanceledException 結束; 否則會在 ZIP 解壓與封裝初始化期間協作檢查取消語彙。

LoadAsync(Stream, OdfLoadOptions?)

Asynchronously loads an ODF document from the specified stream and load options. 非同步從指定資料流與載入選項載入 ODF 文件。

public static Task<OdfDocument> LoadAsync(Stream stream, OdfLoadOptions? options)

Parameters

stream Stream
options OdfLoadOptions

Returns

Task<OdfDocument>

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

LoadAsync(Stream, OdfLoadOptions?, string?)

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

public static Task<OdfDocument> LoadAsync(Stream stream, OdfLoadOptions? options, string? fileName)

Parameters

stream Stream
options OdfLoadOptions
fileName string

Returns

Task<OdfDocument>

LoadAsync(Stream, OdfLoadOptions?, string?, CancellationToken)

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

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

Parameters

stream Stream
options OdfLoadOptions
fileName string
cancellationToken CancellationToken

Returns

Task<OdfDocument>

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<OdfDocument> LoadAsync(Stream stream, string? fileName)

Parameters

stream Stream
fileName string

Returns

Task<OdfDocument>

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<OdfDocument> LoadAsync(Stream stream, string? fileName, CancellationToken cancellationToken)

Parameters

stream Stream
fileName string
cancellationToken CancellationToken

Returns

Task<OdfDocument>

LoadAsync(Stream, CancellationToken)

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

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

Parameters

stream Stream

The document stream. / 文件資料流。

cancellationToken CancellationToken

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

Returns

Task<OdfDocument>

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

LoadAsync(string)

Asynchronously loads an ODF document from the specified path. 非同步從指定路徑載入 ODF 文件。

public static Task<OdfDocument> LoadAsync(string path)

Parameters

path string

Returns

Task<OdfDocument>

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

Remarks

若 已請求取消,作業會立即以 OperationCanceledException 結束; 否則會在 ZIP 解壓與封裝初始化期間協作檢查取消語彙。

LoadAsync(string, OdfLoadOptions?)

Asynchronously loads an ODF document from the specified path and load options. 非同步從指定路徑與載入選項載入 ODF 文件。

public static Task<OdfDocument> LoadAsync(string path, OdfLoadOptions? options)

Parameters

path string
options OdfLoadOptions

Returns

Task<OdfDocument>

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

Remarks

若 已請求取消,作業會立即以 OperationCanceledException 結束; 否則會在 ZIP 解壓與封裝初始化期間協作檢查取消語彙。

LoadAsync(string, OdfLoadOptions?, CancellationToken)

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

public static Task<OdfDocument> LoadAsync(string path, OdfLoadOptions? options, CancellationToken cancellationToken)

Parameters

path string
options OdfLoadOptions
cancellationToken CancellationToken

Returns

Task<OdfDocument>

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<OdfDocument> LoadAsync(string path, CancellationToken cancellationToken)

Parameters

path string
cancellationToken CancellationToken

Returns

Task<OdfDocument>

LoadEncryptedAsync(Stream, string, string?, CancellationToken)

Asynchronously loads and decrypts an ODF document from the specified stream. 非同步從指定資料流載入並解密 ODF 文件。

public static Task<OdfDocument> LoadEncryptedAsync(Stream stream, string password, string? fileName, CancellationToken cancellationToken)

Parameters

stream Stream

The stream containing the ODF document. / 包含 ODF 文件的資料流。

password string

The password used to decrypt the document. / 用於解密文件的密碼。

fileName string

The optional file name used to assist format detection. / 用於輔助格式偵測的選用檔案名稱。

cancellationToken CancellationToken

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

Returns

Task<OdfDocument>

A task whose result is the decrypted document. / 工作結果為已解密文件。

LoadEncryptedAsync(string, string, CancellationToken)

Asynchronously loads and decrypts an ODF document from the specified path. 非同步從指定路徑載入並解密 ODF 文件。

public static Task<OdfDocument> LoadEncryptedAsync(string path, string password, CancellationToken cancellationToken)

Parameters

path string

The ODF document path. / ODF 文件路徑。

password string

The password used to decrypt the document. / 用於解密文件的密碼。

cancellationToken CancellationToken

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

Returns

Task<OdfDocument>

A task whose result is the decrypted document. / 工作結果為已解密文件。

LoadFromFlatXml(Stream)

Loads an ODF document from the specified Flat XML stream. 從指定的 Flat XML 資料流載入 ODF 文件。

public static OdfDocument LoadFromFlatXml(Stream stream)

Parameters

stream Stream

The Flat XML stream. / Flat XML 資料流。

Returns

OdfDocument

The loaded ODF document. / 載入完成的 ODF 文件。

LoadFromFlatXml(Stream, OdfLoadOptions?)

Loads an ODF document from the specified Flat XML stream and load options. 從指定的 Flat XML 資料流與載入選項載入 ODF 文件。

public static OdfDocument LoadFromFlatXml(Stream stream, OdfLoadOptions? options)

Parameters

stream Stream

The Flat XML stream. / Flat XML 資料流。

options OdfLoadOptions

The load options; when null, defaults are used. / 載入選項;若為 null,則使用預設選項。

Returns

OdfDocument

The loaded ODF document. / 載入完成的 ODF 文件。

LoadFromFlatXml(string)

Loads an ODF document from the specified Flat XML file path. 從指定的 Flat XML 檔案載入 ODF 文件。

public static OdfDocument LoadFromFlatXml(string path)

Parameters

path string

The Flat XML file path. / Flat XML 檔案路徑。

Returns

OdfDocument

The loaded ODF document. / 載入完成的 ODF 文件。

LoadFromFlatXml(string, OdfLoadOptions?)

Loads an ODF document from the specified Flat XML file path and load options. 從指定的 Flat XML 檔案與載入選項載入 ODF 文件。

public static OdfDocument LoadFromFlatXml(string path, OdfLoadOptions? options)

Parameters

path string

The Flat XML file path. / Flat XML 檔案路徑。

options OdfLoadOptions

The load options; when null, defaults are used. / 載入選項;若為 null,則使用預設選項。

Returns

OdfDocument

The loaded ODF document. / 載入完成的 ODF 文件。

MergeContentNodes(OdfDocument, OdfMergeOptions, Dictionary<string, string>)

Merges content nodes. 將來源文件的內容節點合併到目前文件。

protected abstract void MergeContentNodes(OdfDocument sourceDoc, OdfMergeOptions options, Dictionary<string, string> renameMap)

Parameters

sourceDoc OdfDocument

來源文件

options OdfMergeOptions

合併選項

renameMap Dictionary<string, string>

樣式重新命名對照表

RemapStylesInNodes(OdfNode, Dictionary<string, string>)

Performs remap styles in nodes. 依樣式重新命名對照表重寫節點樹中的樣式參照。

protected void RemapStylesInNodes(OdfNode node, Dictionary<string, string> renameMap)

Parameters

node OdfNode

要處理的根節點

renameMap Dictionary<string, string>

樣式重新命名對照表

ReplaceText(string, string)

Searches the entire document's DOM tree for the specified text and replaces it with new text, preserving the text's formatting and style structure. 在整份文件的 DOM 樹中搜尋指定文字並替換為新文字,同時保留文字的格式與樣式結構。

public virtual void ReplaceText(string search, string replacement)

Parameters

search string

The keyword to search for. / 要搜尋的關鍵字。

replacement string

The new text to replace it with. / 要替換的新文字。

SanitizeMacros()

Sanitizes the document, removing all VBA and StarBasic macro scripts, digital signatures, and script references. 清理文件,移除所有 VBA 與 StarBasic 巨集指令碼、數位簽章及指令碼參照。

public void SanitizeMacros()

Save()

Saves the document back to its package container. 將文件儲存回其 ODF 封裝容器。

public virtual void Save()

Remarks

Prefer SaveAsync(OdfSaveOptions?, CancellationToken) in server environments to avoid blocking request threads. 在 ASP.NET Core 等伺服器環境中,請優先使用 SaveAsync(OdfSaveOptions?, CancellationToken) 以避免阻塞要求執行緒。

Save(OdfSaveOptions?)

Full overload of Save that accepts options. Save 完整多載:接受 options。

public virtual void Save(OdfSaveOptions? options)

Parameters

options OdfSaveOptions

Save(string)

Saves the document to the specified file path. 將文件儲存至指定檔案路徑。

public void Save(string path)

Parameters

path string

Save(string, OdfSaveOptions?)

Full overload of Save that accepts path and options. Save 完整多載:接受 path 與 options。

public void Save(string path, OdfSaveOptions? options)

Parameters

path string
options OdfSaveOptions

SaveAsFlatXml(Stream)

Saves as flat xml. 將文件儲存為單一 Flat XML 格式並寫入指定的資料流。

public void SaveAsFlatXml(Stream stream)

Parameters

stream Stream

SaveAsFlatXml(Stream, OdfSaveOptions?)

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

public void SaveAsFlatXml(Stream stream, OdfSaveOptions? options)

Parameters

stream Stream
options OdfSaveOptions

SaveAsFlatXml(string)

Saves as flat xml. 將文件儲存為單一 Flat XML 格式的檔案。

public void SaveAsFlatXml(string path)

Parameters

path string

SaveAsFlatXml(string, OdfSaveOptions?)

Full overload of SaveAsFlatXml that accepts path and options. SaveAsFlatXml 完整多載:接受 path 與 options。

public void SaveAsFlatXml(string path, OdfSaveOptions? options)

Parameters

path string
options OdfSaveOptions

SaveAsync()

Saves async. 非同步儲存文件至 ODF 封裝容器中。

public virtual Task SaveAsync()

Returns

Task

代表非同步作業的 Task 執行個體

Remarks

若 已請求取消,作業會立即以 OperationCanceledException 結束; 否則會在 ZIP 寫入與串流 I/O 期間協作檢查取消語彙。

SaveAsync(OdfSaveOptions?)

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

public virtual Task SaveAsync(OdfSaveOptions? options)

Parameters

options OdfSaveOptions

Returns

Task

SaveAsync(OdfSaveOptions?, CancellationToken)

Full overload of SaveAsync that accepts options and cancellationToken. SaveAsync 完整多載:接受 options 與 cancellationToken。

public virtual Task SaveAsync(OdfSaveOptions? options, CancellationToken cancellationToken)

Parameters

options OdfSaveOptions
cancellationToken CancellationToken

Returns

Task

SaveAsync(Stream)

Saves async. 非同步將文件儲存至指定的資料流。

public Task SaveAsync(Stream destinationStream)

Parameters

destinationStream Stream

Returns

Task

代表非同步儲存作業的工作

SaveAsync(Stream, OdfSaveOptions?)

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

public Task SaveAsync(Stream destinationStream, OdfSaveOptions? options)

Parameters

destinationStream Stream
options OdfSaveOptions

Returns

Task

SaveAsync(Stream, OdfSaveOptions?, CancellationToken)

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

public Task SaveAsync(Stream destinationStream, OdfSaveOptions? options, CancellationToken cancellationToken)

Parameters

destinationStream Stream
options OdfSaveOptions
cancellationToken CancellationToken

Returns

Task

SaveAsync(Stream, CancellationToken)

Asynchronously saves the document to the specified stream with a cancellation token. 以取消語彙基元非同步將文件儲存至指定資料流。

public Task SaveAsync(Stream destinationStream, CancellationToken cancellationToken)

Parameters

destinationStream Stream

The destination stream. / 目標資料流。

cancellationToken CancellationToken

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

Returns

Task

A task representing the asynchronous save operation. / 代表非同步儲存作業的工作。

SaveAsync(string)

Saves async. 非同步將文件儲存至指定檔案路徑。

public Task SaveAsync(string path)

Parameters

path string

Returns

Task

代表非同步儲存作業的工作

Remarks

若 已請求取消,作業會立即以 OperationCanceledException 結束; 否則會在 ZIP 寫入與檔案 I/O 期間協作檢查取消語彙。

SaveAsync(string, OdfSaveOptions?)

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

public Task SaveAsync(string path, OdfSaveOptions? options)

Parameters

path string
options OdfSaveOptions

Returns

Task

SaveAsync(string, OdfSaveOptions?, CancellationToken)

Full overload of SaveAsync that accepts path, options, and cancellationToken. SaveAsync 完整多載:接受 path、options 與 cancellationToken。

public Task SaveAsync(string path, OdfSaveOptions? options, CancellationToken cancellationToken)

Parameters

path string
options OdfSaveOptions
cancellationToken CancellationToken

Returns

Task

SaveAsync(string, CancellationToken)

Asynchronously saves the document to the specified path with a cancellation token. 以取消語彙基元非同步將文件儲存至指定路徑。

public Task SaveAsync(string path, CancellationToken cancellationToken)

Parameters

path string

The destination file path. / 目標檔案路徑。

cancellationToken CancellationToken

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

Returns

Task

A task representing the asynchronous save operation. / 代表非同步儲存作業的工作。

SaveEncryptedAsync(Stream, string, OdfEncryptionAlgorithm, CancellationToken)

Asynchronously saves the document to the specified stream with password encryption. 非同步以密碼加密並將文件儲存至指定資料流。

public Task SaveEncryptedAsync(Stream destinationStream, string password, OdfEncryptionAlgorithm algorithm, CancellationToken cancellationToken)

Parameters

destinationStream Stream

The destination stream. / 目的地資料流。

password string

The password used to encrypt the document. / 用於加密文件的密碼。

algorithm OdfEncryptionAlgorithm

The encryption algorithm to use. / 要使用的加密演算法。

cancellationToken CancellationToken

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

Returns

Task

A task representing the asynchronous save operation. / 代表非同步儲存作業的工作。

SaveEncryptedAsync(string, OdfEncryptionAlgorithm, CancellationToken)

Asynchronously saves the document to its original destination with password encryption. 非同步以密碼加密並將文件儲存至原始目的地。

public Task SaveEncryptedAsync(string password, OdfEncryptionAlgorithm algorithm, CancellationToken cancellationToken)

Parameters

password string

The password used to encrypt the document. / 用於加密文件的密碼。

algorithm OdfEncryptionAlgorithm

The encryption algorithm to use. / 要使用的加密演算法。

cancellationToken CancellationToken

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

Returns

Task

A task representing the asynchronous save operation. / 代表非同步儲存作業的工作。

SaveEncryptedAsync(string, string, OdfEncryptionAlgorithm, CancellationToken)

Asynchronously saves the document to the specified path with password encryption. 非同步以密碼加密並將文件儲存至指定路徑。

public Task SaveEncryptedAsync(string path, string password, OdfEncryptionAlgorithm algorithm, CancellationToken cancellationToken)

Parameters

path string

The destination file path. / 目的地檔案路徑。

password string

The password used to encrypt the document. / 用於加密文件的密碼。

algorithm OdfEncryptionAlgorithm

The encryption algorithm to use. / 要使用的加密演算法。

cancellationToken CancellationToken

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

Returns

Task

A task representing the asynchronous save operation. / 代表非同步儲存作業的工作。

SaveToBytes()

Saves to bytes. 將文件儲存為 ODF 封裝位元組陣列。

public byte[] SaveToBytes()

Returns

byte[]

包含文件封裝內容的位元組陣列

SaveToStream(Stream)

Saves to stream. 將文件儲存至指定的資料流。

public void SaveToStream(Stream destinationStream)

Parameters

destinationStream Stream

SaveToStream(Stream, OdfSaveOptions?)

Full overload of SaveToStream that accepts destinationStream and options. SaveToStream 完整多載:接受 destinationStream 與 options。

public void SaveToStream(Stream destinationStream, OdfSaveOptions? options)

Parameters

destinationStream Stream
options OdfSaveOptions

SaveToStreamAsync(Stream)

Saves to stream async. 非同步將文件儲存至指定的資料流。

public Task SaveToStreamAsync(Stream destinationStream)

Parameters

destinationStream Stream

Returns

Task

代表非同步儲存作業的工作

Remarks

若 已請求取消,作業會立即以 OperationCanceledException 結束; 否則會在 ZIP 寫入與串流 I/O 期間協作檢查取消語彙。

SaveToStreamAsync(Stream, OdfSaveOptions?)

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

public Task SaveToStreamAsync(Stream destinationStream, OdfSaveOptions? options)

Parameters

destinationStream Stream
options OdfSaveOptions

Returns

Task

SaveToStreamAsync(Stream, OdfSaveOptions?, CancellationToken)

Full overload of SaveToStreamAsync that accepts destinationStream, options, and cancellationToken. SaveToStreamAsync 完整多載:接受 destinationStream、options 與 cancellationToken。

public Task SaveToStreamAsync(Stream destinationStream, OdfSaveOptions? options, CancellationToken cancellationToken)

Parameters

destinationStream Stream
options OdfSaveOptions
cancellationToken CancellationToken

Returns

Task

SaveToStreamAsync(Stream, CancellationToken)

Asynchronously saves the document to the specified stream with a cancellation token. 以取消語彙基元非同步將文件儲存至指定資料流。

public Task SaveToStreamAsync(Stream destinationStream, CancellationToken cancellationToken)

Parameters

destinationStream Stream

The destination stream. / 目標資料流。

cancellationToken CancellationToken

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

Returns

Task

A task representing the asynchronous save operation. / 代表非同步儲存作業的工作。

SetCustomProperty(string, bool)

Sets a Boolean custom metadata property. 設定布林類型的自訂中繼資料屬性。

public void SetCustomProperty(string name, bool value)

Parameters

name string
value bool

SetCustomProperty(string, DateTime)

Sets a date custom metadata property. 設定日期類型的自訂中繼資料屬性。

public void SetCustomProperty(string name, DateTime value)

Parameters

name string
value DateTime

SetCustomProperty(string, double)

Sets a floating-point custom metadata property. 設定浮點數類型的自訂中繼資料屬性。

public void SetCustomProperty(string name, double value)

Parameters

name string
value double

SetCustomProperty(string, int)

Sets an integer custom metadata property. 設定整數類型的自訂中繼資料屬性。

public void SetCustomProperty(string name, int value)

Parameters

name string
value int

SetCustomProperty(string, string)

Sets a string custom metadata property. 設定字串類型的自訂中繼資料屬性。

public void SetCustomProperty(string name, string value)

Parameters

name string
value string

Sign(X509Certificate2)

Signs the document with the specified X.509 certificate. 使用指定的 X.509 憑證簽署文件。

public void Sign(X509Certificate2 certificate)

Parameters

certificate X509Certificate2

The certificate used to sign the document. / 用於簽署文件的憑證。

Remarks

Prefer SignAsync(X509Certificate2, CancellationToken) in server environments to avoid blocking request threads. 在 ASP.NET Core 等伺服器環境中,請優先使用 SignAsync(X509Certificate2, CancellationToken) 以避免阻塞要求執行緒。

SignAsync(X509Certificate2)

Asynchronously signs the document with the specified X.509 certificate. 非同步使用指定的 X.509 憑證簽署文件。

public Task SignAsync(X509Certificate2 certificate)

Parameters

certificate X509Certificate2

Returns

Task

A task representing the asynchronous signing operation. / 代表非同步簽署作業的工作。

Remarks

若 已請求取消,作業會立即以 OperationCanceledException 結束; 否則會在 DOM 寫入、ZIP 寫入與 HTTP(TSA/CRL)期間協作檢查取消語彙。

SignAsync(X509Certificate2, CancellationToken)

Full overload of SignAsync that accepts certificate and cancellationToken. SignAsync 完整多載:接受 certificate 與 cancellationToken。

public Task SignAsync(X509Certificate2 certificate, CancellationToken cancellationToken)

Parameters

certificate X509Certificate2
cancellationToken CancellationToken

Returns

Task

SignDocumentAsync(X509Certificate2)

Signs document async. 非同步使用指定的 X.509 憑證對文件進行一鍵式數位簽章。

public Task SignDocumentAsync(X509Certificate2 certificate)

Parameters

certificate X509Certificate2

Returns

Task

代表非同步簽章作業的工作

Remarks

此方法是計畫文件中 SignDocumentAsync 入口的文件層別名;行為等同於 SignAsync(X509Certificate2, CancellationToken)

SignDocumentAsync(X509Certificate2, OdfSigningOptions?)

Signs document async. 非同步使用指定的 X.509 憑證與簽章選項對文件進行一鍵式數位簽章。

public Task SignDocumentAsync(X509Certificate2 certificate, OdfSigningOptions? options)

Parameters

certificate X509Certificate2
options OdfSigningOptions

Returns

Task

代表非同步簽章作業的工作

Remarks

若 已請求取消,作業會立即以 OperationCanceledException 結束; 否則會在 DOM 寫入、ZIP 寫入與 HTTP(TSA/CRL)期間協作檢查取消語彙。

SignDocumentAsync(X509Certificate2, OdfSigningOptions?, CancellationToken)

Full overload of SignDocumentAsync that accepts certificate, options, and cancellationToken. SignDocumentAsync 完整多載:接受 certificate、options 與 cancellationToken。

public Task SignDocumentAsync(X509Certificate2 certificate, OdfSigningOptions? options, CancellationToken cancellationToken)

Parameters

certificate X509Certificate2
options OdfSigningOptions
cancellationToken CancellationToken

Returns

Task

SignDocumentAsync(X509Certificate2, CancellationToken)

Full overload of SignDocumentAsync that accepts certificate and cancellationToken. SignDocumentAsync 完整多載:接受 certificate 與 cancellationToken。

public Task SignDocumentAsync(X509Certificate2 certificate, CancellationToken cancellationToken)

Parameters

certificate X509Certificate2
cancellationToken CancellationToken

Returns

Task

UpdateDocumentStatistics()

Updates metadata statistics for the current document. 更新文件統計中繼資料。

protected virtual void UpdateDocumentStatistics()

Validate()

Short overload of Validate that uses default values for all optional parameters and forwards to the full overload. 便利多載:Validate 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfValidationReport Validate()

Returns

OdfValidationReport

Validate(OdfComplianceProfile?)

Performs the Validate operation. 驗證目前文件(反映記憶體中尚未儲存的編輯內容)是否符合 ODF 規格。

public OdfValidationReport Validate(OdfComplianceProfile? profile)

Parameters

profile OdfComplianceProfile

相容性設定檔;若為 null 則使用預設設定檔

Returns

OdfValidationReport

結構化驗證結果報告

Remarks

此方法會先將目前 DOM 狀態序列化為記憶體中的暫存封裝(不影響原始 Package 或來源檔案),再交由 OdfValidator 驗證,因此可反映呼叫前所做的任何編輯。

ValidateAsync()

Short overload of ValidateAsync that uses default values for all optional parameters and forwards to the full overload. 便利多載:ValidateAsync 的所有可選參數使用預設值並轉呼叫最長多載。

public Task<OdfValidationReport> ValidateAsync()

Returns

Task<OdfValidationReport>

ValidateAsync(OdfComplianceProfile?)

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

public Task<OdfValidationReport> ValidateAsync(OdfComplianceProfile? profile)

Parameters

profile OdfComplianceProfile

Returns

Task<OdfValidationReport>

ValidateAsync(OdfComplianceProfile?, CancellationToken)

Validates async. 非同步驗證目前文件(反映記憶體中尚未儲存的編輯內容)是否符合 ODF 規格。

public Task<OdfValidationReport> ValidateAsync(OdfComplianceProfile? profile, CancellationToken cancellationToken)

Parameters

profile OdfComplianceProfile

相容性設定檔;若為 null 則使用預設設定檔

cancellationToken CancellationToken

取消語彙基元

Returns

Task<OdfValidationReport>

代表非同步驗證作業的工作,其結果為結構化驗證結果報告

VerifySignatures()

Verifies signatures. 驗證文件中的所有數位簽章,並傳回詳細驗證結果。

public OdfSignatureValidationResult VerifySignatures()

Returns

OdfSignatureValidationResult

詳細的數位簽章驗證結果

VerifySignatures(OdfSigningOptions?)

Full overload of VerifySignatures that accepts options. VerifySignatures 完整多載:接受 options。

public OdfSignatureValidationResult VerifySignatures(OdfSigningOptions? options)

Parameters

options OdfSigningOptions

Returns

OdfSignatureValidationResult

VerifySignatures(out X509Certificate2Collection)

Verifies signatures. 驗證文件中的所有數位簽章。

public bool VerifySignatures(out X509Certificate2Collection certificates)

Parameters

certificates X509Certificate2Collection

輸出參數,傳回驗證通過的憑證集合

Returns

bool

若所有簽章皆驗證成功則傳回 true;否則傳回 false

VerifySignaturesAsync()

Verifies signatures async. 非同步驗證文件中的所有數位簽章,並傳回詳細驗證結果。

public Task<OdfSignatureValidationResult> VerifySignaturesAsync()

Returns

Task<OdfSignatureValidationResult>

代表非同步驗證作業的工作,其結果包含詳細的數位簽章驗證結果

Remarks

若 已請求取消,作業會立即以 OperationCanceledException 結束; 否則會在簽章解析與 HTTP(CRL)期間協作檢查取消語彙。

VerifySignaturesAsync(OdfSigningOptions?)

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

public Task<OdfSignatureValidationResult> VerifySignaturesAsync(OdfSigningOptions? options)

Parameters

options OdfSigningOptions

Returns

Task<OdfSignatureValidationResult>

VerifySignaturesAsync(OdfSigningOptions?, CancellationToken)

Full overload of VerifySignaturesAsync that accepts options and cancellationToken. VerifySignaturesAsync 完整多載:接受 options 與 cancellationToken。

public Task<OdfSignatureValidationResult> VerifySignaturesAsync(OdfSigningOptions? options, CancellationToken cancellationToken)

Parameters

options OdfSigningOptions
cancellationToken CancellationToken

Returns

Task<OdfSignatureValidationResult>

VerifySignaturesAsync(CancellationToken)

Asynchronously verifies all digital signatures with a cancellation token. 以取消語彙基元非同步驗證所有數位簽章。

public Task<OdfSignatureValidationResult> VerifySignaturesAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

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

Returns

Task<OdfSignatureValidationResult>

A task whose result is the detailed signature validation result. / 代表非同步驗證作業的工作,其結果包含詳細的數位簽章驗證結果。