Class OdfDocumentFactory
Creates minimal low-level ODF packages and flat XML documents. 建立最小的低階 ODF 封裝與扁平 XML 文件。
public static class OdfDocumentFactory
- Inheritance
-
OdfDocumentFactory
- Inherited Members
Methods
CreateDocument(OdfDocumentKind)
Creates a high-level ODF document wrapper of the specified kind. 建立指定種類的高階 ODF 文件 wrapper。
public static OdfDocument CreateDocument(OdfDocumentKind kind)
Parameters
kindOdfDocumentKindThe ODF document kind to create. / 要建立的 ODF 文件種類。
Returns
- OdfDocument
The created ODF document. / 建立完成的 ODF 文件。
CreatePackage(Stream, OdfDocumentKind)
Creates a minimally packaged ODF document in the provided stream. 在提供的資料流中建立一個最小封裝的 ODF 文件。
public static OdfPackage CreatePackage(Stream stream, OdfDocumentKind kind)
Parameters
streamStreamkindOdfDocumentKind
Returns
- OdfPackage
The created OdfPackage instance. / 傳回建立的 OdfPackage 執行個體。
CreatePackage(Stream, OdfDocumentKind, OdfVersion)
Short overload of CreatePackage that accepts stream, kind, and version; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream、kind 與 version;其餘可選參數使用預設值並轉呼叫最長 CreatePackage 多載。
public static OdfPackage CreatePackage(Stream stream, OdfDocumentKind kind, OdfVersion version)
Parameters
streamStreamkindOdfDocumentKindversionOdfVersion
Returns
CreatePackage(Stream, OdfDocumentKind, OdfVersion, bool)
Short overload of CreatePackage that accepts stream, kind, version, and leaveOpen; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream、kind、version 與 leaveOpen;其餘可選參數使用預設值並轉呼叫最長 CreatePackage 多載。
public static OdfPackage CreatePackage(Stream stream, OdfDocumentKind kind, OdfVersion version, bool leaveOpen)
Parameters
streamStreamkindOdfDocumentKindversionOdfVersionleaveOpenbool
Returns
CreatePackage(Stream, OdfDocumentKind, OdfVersion, bool, OdfSaveOptions?)
Short overload of CreatePackage that accepts stream, kind, version, leaveOpen, and options; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream、kind、version、leaveOpen 與 options;其餘可選參數使用預設值並轉呼叫最長 CreatePackage 多載。
public static OdfPackage CreatePackage(Stream stream, OdfDocumentKind kind, OdfVersion version, bool leaveOpen, OdfSaveOptions? options)
Parameters
streamStreamkindOdfDocumentKindversionOdfVersionleaveOpenbooloptionsOdfSaveOptions
Returns
CreatePackage(Stream, OdfDocumentKind, bool)
Creates a minimally packaged ODF document in the provided stream with an explicit leave-open flag. 在提供的資料流中建立最小封裝 ODF 文件,並明確指定是否保持資料流開啟。
public static OdfPackage CreatePackage(Stream stream, OdfDocumentKind kind, bool leaveOpen)
Parameters
streamStreamThe destination stream. / 目標資料流。
kindOdfDocumentKindThe ODF document kind. / ODF 文件種類。
leaveOpenboolWhether to leave the stream open after disposing the package. / 封裝釋放後是否保持資料流開啟。
Returns
- OdfPackage
The created OdfPackage instance. / 傳回建立的 OdfPackage 執行個體。
CreatePackage(string, OdfDocumentKind)
Creates a minimally packaged ODF document at the provided path. 在提供的路徑上建立一個最小封裝的 ODF 文件。
public static OdfPackage CreatePackage(string path, OdfDocumentKind kind)
Parameters
pathstringkindOdfDocumentKind
Returns
- OdfPackage
The created OdfPackage instance. / 傳回建立的 OdfPackage 執行個體。
CreatePackage(string, OdfDocumentKind, OdfVersion)
Short overload of CreatePackage that accepts path, kind, and version; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 path、kind 與 version;其餘可選參數使用預設值並轉呼叫最長 CreatePackage 多載。
public static OdfPackage CreatePackage(string path, OdfDocumentKind kind, OdfVersion version)
Parameters
pathstringkindOdfDocumentKindversionOdfVersion
Returns
CreatePackage(string, OdfDocumentKind, OdfVersion, OdfSaveOptions?)
Short overload of CreatePackage that accepts path, kind, version, and options; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 path、kind、version 與 options;其餘可選參數使用預設值並轉呼叫最長 CreatePackage 多載。
public static OdfPackage CreatePackage(string path, OdfDocumentKind kind, OdfVersion version, OdfSaveOptions? options)
Parameters
pathstringkindOdfDocumentKindversionOdfVersionoptionsOdfSaveOptions
Returns
InitializeMinimalPackage(OdfPackage, OdfDocumentKind)
Short overload of InitializeMinimalPackage that accepts package and kind; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 package 與 kind;其餘可選參數使用預設值並轉呼叫最長 InitializeMinimalPackage 多載。
public static void InitializeMinimalPackage(OdfPackage package, OdfDocumentKind kind)
Parameters
packageOdfPackagekindOdfDocumentKind
InitializeMinimalPackage(OdfPackage, OdfDocumentKind, OdfVersion)
Populates the package with a minimal ODF entity of the specified document kind. 以指定的文件類型在封裝中填入最小的 ODF 實體。
public static void InitializeMinimalPackage(OdfPackage package, OdfDocumentKind kind, OdfVersion version)
Parameters
packageOdfPackageThe OdfPackage instance to initialize. / 要初始化的 OdfPackage 執行個體。
kindOdfDocumentKindThe ODF document kind. / ODF 文件的類型。
versionOdfVersionThe ODF specification version. / ODF 規格版本。
LoadDocument(Stream)
Loads a high-level ODF document wrapper from the specified stream. 從指定資料流載入高階 ODF 文件 wrapper。
public static OdfDocument LoadDocument(Stream stream)
Parameters
streamStream
Returns
- OdfDocument
The loaded ODF document. / 載入完成的 ODF 文件。
LoadDocument(Stream, OdfLoadOptions?)
Short overload of LoadDocument that accepts stream and options; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream 與 options;其餘可選參數使用預設值並轉呼叫最長 LoadDocument 多載。
public static OdfDocument LoadDocument(Stream stream, OdfLoadOptions? options)
Parameters
streamStreamoptionsOdfLoadOptions
Returns
LoadDocument(Stream, OdfLoadOptions?, string?)
Loads a high-level ODF document wrapper from the specified stream and load options. 從指定資料流與載入選項載入高階 ODF 文件 wrapper。
public static OdfDocument LoadDocument(Stream stream, OdfLoadOptions? options, string? fileName)
Parameters
streamStreamThe stream containing the ODF document content. / 包含 ODF 文件內容的資料流。
optionsOdfLoadOptionsThe load options, such as a password for encrypted documents and security limits. / 載入選項,例如加密文件密碼與安全限制。
fileNamestringThe optional file name, used to assist format detection. / 選用的檔案名稱,用於輔助格式偵測。
Returns
- OdfDocument
The loaded ODF document. / 載入完成的 ODF 文件。
LoadDocument(Stream, string?)
Short overload of LoadDocument that accepts stream and fileName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream 與 fileName;其餘可選參數使用預設值並轉呼叫最長 LoadDocument 多載。
public static OdfDocument LoadDocument(Stream stream, string? fileName)
Parameters
Returns
LoadDocument(string)
Loads a high-level ODF document wrapper from the specified path. 從指定路徑載入高階 ODF 文件 wrapper。
public static OdfDocument LoadDocument(string path)
Parameters
pathstringThe ODF document path. / ODF 文件路徑。
Returns
- OdfDocument
The loaded ODF document. / 載入完成的 ODF 文件。
LoadDocument(string, OdfLoadOptions?)
Loads a high-level ODF document wrapper from the specified path and load options. 從指定路徑與載入選項載入高階 ODF 文件 wrapper。
public static OdfDocument LoadDocument(string path, OdfLoadOptions? options)
Parameters
pathstringThe ODF document path. / ODF 文件路徑。
optionsOdfLoadOptionsThe load options, such as a password for encrypted documents and security limits. / 載入選項,例如加密文件密碼與安全限制。
Returns
- OdfDocument
The loaded ODF document. / 載入完成的 ODF 文件。
LoadDocumentAsync(Stream)
Asynchronously loads a high-level ODF document wrapper from the specified stream. 非同步從指定資料流載入高階 ODF 文件 wrapper。
public static Task<OdfDocument> LoadDocumentAsync(Stream stream)
Parameters
streamStream
Returns
- Task<OdfDocument>
A task representing the asynchronous load operation, whose result is the loaded ODF document. / 代表非同步載入作業的工作,其結果為載入完成的 ODF 文件。
LoadDocumentAsync(Stream, OdfLoadOptions?)
Short overload of LoadDocumentAsync that accepts stream and options; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream 與 options;其餘可選參數使用預設值並轉呼叫最長 LoadDocumentAsync 多載。
public static Task<OdfDocument> LoadDocumentAsync(Stream stream, OdfLoadOptions? options)
Parameters
streamStreamoptionsOdfLoadOptions
Returns
LoadDocumentAsync(Stream, OdfLoadOptions?, string?)
Short overload of LoadDocumentAsync that accepts stream, options, and fileName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream、options 與 fileName;其餘可選參數使用預設值並轉呼叫最長 LoadDocumentAsync 多載。
public static Task<OdfDocument> LoadDocumentAsync(Stream stream, OdfLoadOptions? options, string? fileName)
Parameters
streamStreamoptionsOdfLoadOptionsfileNamestring
Returns
LoadDocumentAsync(Stream, OdfLoadOptions?, string?, CancellationToken)
Asynchronously loads a high-level ODF document wrapper from the specified stream and load options. 非同步從指定資料流與載入選項載入高階 ODF 文件 wrapper。
public static Task<OdfDocument> LoadDocumentAsync(Stream stream, OdfLoadOptions? options, string? fileName, CancellationToken cancellationToken)
Parameters
streamStreamThe stream containing the ODF document content. / 包含 ODF 文件內容的資料流。
optionsOdfLoadOptionsThe load options, such as a password for encrypted documents and security limits. / 載入選項,例如加密文件密碼與安全限制。
fileNamestringThe optional file name, used to assist format detection. / 選用的檔案名稱,用於輔助格式偵測。
cancellationTokenCancellationTokenThe cancellation token. / 取消語彙基元。
Returns
- Task<OdfDocument>
A task representing the asynchronous load operation, whose result is the loaded ODF document. / 代表非同步載入作業的工作,其結果為載入完成的 ODF 文件。
LoadDocumentAsync(Stream, string?)
Short overload of LoadDocumentAsync that accepts stream and fileName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream 與 fileName;其餘可選參數使用預設值並轉呼叫最長 LoadDocumentAsync 多載。
public static Task<OdfDocument> LoadDocumentAsync(Stream stream, string? fileName)
Parameters
Returns
LoadDocumentAsync(Stream, string?, CancellationToken)
Short overload of LoadDocumentAsync that accepts stream, fileName, and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream、fileName 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 LoadDocumentAsync 多載。
public static Task<OdfDocument> LoadDocumentAsync(Stream stream, string? fileName, CancellationToken cancellationToken)
Parameters
streamStreamfileNamestringcancellationTokenCancellationToken
Returns
LoadDocumentAsync(string)
Asynchronously loads a high-level ODF document wrapper from the specified path. 非同步從指定路徑載入高階 ODF 文件 wrapper。
public static Task<OdfDocument> LoadDocumentAsync(string path)
Parameters
pathstring
Returns
- Task<OdfDocument>
A task representing the asynchronous load operation, whose result is the loaded ODF document. / 代表非同步載入作業的工作,其結果為載入完成的 ODF 文件。
LoadDocumentAsync(string, OdfLoadOptions?)
Asynchronously loads a high-level ODF document wrapper from the specified path and load options. 非同步從指定路徑與載入選項載入高階 ODF 文件 wrapper。
public static Task<OdfDocument> LoadDocumentAsync(string path, OdfLoadOptions? options)
Parameters
pathstringoptionsOdfLoadOptions
Returns
- Task<OdfDocument>
A task representing the asynchronous load operation, whose result is the loaded ODF document. / 代表非同步載入作業的工作,其結果為載入完成的 ODF 文件。
LoadDocumentAsync(string, OdfLoadOptions?, CancellationToken)
Short overload of LoadDocumentAsync that accepts path, options, and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 path、options 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 LoadDocumentAsync 多載。
public static Task<OdfDocument> LoadDocumentAsync(string path, OdfLoadOptions? options, CancellationToken cancellationToken)
Parameters
pathstringoptionsOdfLoadOptionscancellationTokenCancellationToken
Returns
LoadDocumentAsync(string, CancellationToken)
Short overload of LoadDocumentAsync that accepts path and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 path 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 LoadDocumentAsync 多載。
public static Task<OdfDocument> LoadDocumentAsync(string path, CancellationToken cancellationToken)
Parameters
pathstringcancellationTokenCancellationToken
Returns
WriteFlatXml(Stream, OdfDocumentKind)
Writes a minimal flat XML ODF document with default write options. 以預設寫入選項寫入最小 Flat XML ODF 文件。
public static void WriteFlatXml(Stream stream, OdfDocumentKind kind)
Parameters
streamStreamThe destination stream. / 目的串流。
kindOdfDocumentKindThe ODF document kind. / ODF 文件種類。
WriteFlatXml(Stream, OdfDocumentKind, OdfFlatXmlWriteOptions)
Writes a minimal flat XML ODF document using write options. 以寫入選項寫入最小 Flat XML ODF 文件。
public static void WriteFlatXml(Stream stream, OdfDocumentKind kind, OdfFlatXmlWriteOptions options)
Parameters
streamStreamThe destination stream. / 目的串流。
kindOdfDocumentKindThe ODF document kind. / ODF 文件種類。
optionsOdfFlatXmlWriteOptionsThe flat XML write options. / Flat XML 寫入選項。