Table of Contents

Class OdfSaveOptions

Namespace
OdfKit.Core
Assembly
OdfKit.dll

Controls package layout, compatibility, and encryption behavior used when saving ODF documents. 控制儲存 ODF 文件時使用的封裝配置、相容性與加密行為。

public class OdfSaveOptions
Inheritance
OdfSaveOptions
Inherited Members

Constructors

OdfSaveOptions()

public OdfSaveOptions()

Properties

CompressionLevel

Gets or sets the ZIP compression level used for package entries. 取得或設定封裝項目使用的 ZIP 壓縮等級。

public CompressionLevel CompressionLevel { get; set; }

Property Value

CompressionLevel

CryptographyProvider

Gets or sets the cryptography provider used to encrypt package entries. 取得或設定用於加密封裝項目的密碼學提供者。

public IOdfCryptographyProvider? CryptographyProvider { get; set; }

Property Value

IOdfCryptographyProvider

Default

Gets a new instance with the default save settings. 取得使用預設儲存設定的新執行個體。

public static OdfSaveOptions Default { get; }

Property Value

OdfSaveOptions

Deterministic

Gets or sets a value indicating whether repeat saves should produce deterministic ZIP metadata. 取得或設定重複儲存是否產生確定性的 ZIP 中繼資料。

public bool Deterministic { get; set; }

Property Value

bool

Remarks

When enabled, ZIP entry timestamps are pinned so unchanged content produces repeatable binary hashes. 啟用時,所有 ZIP 封裝項目的 LastWriteTime 會固定,讓內容不變時產生可重複的二進位雜湊值。

DocumentCulture

Gets or sets the culture used for user-facing document formatting decisions. 取得或設定用於面向使用者之文件格式化決策的文化語系。

public CultureInfo DocumentCulture { get; set; }

Property Value

CultureInfo

Remarks

The invariant culture is still used for raw XML numeric and date serialization. 此設定用於轉譯貨幣、日期時間等格式化字串;底層 XML 的浮點數與日期序列化仍一律使用不變文化。

EmbedUsedFonts

Gets or sets a value indicating whether fonts referenced by the document are embedded on save. 取得或設定儲存時是否內嵌文件參照的字型。

public bool EmbedUsedFonts { get; set; }

Property Value

bool

EnableDirectIo

Gets or sets a value indicating whether Direct I/O is used for uncached package writes. 取得或設定是否啟用 Direct I/O 進行非快取封裝寫入。

public bool EnableDirectIo { get; set; }

Property Value

bool

EncryptionAlgorithm

Gets or sets the algorithm used when password or OpenPGP encryption is enabled. 取得或設定啟用密碼或 OpenPGP 加密時使用的演算法。

public OdfEncryptionAlgorithm EncryptionAlgorithm { get; set; }

Property Value

OdfEncryptionAlgorithm

EvaluateFormulasOnSave

Gets or sets a value indicating whether spreadsheet formulas are evaluated before saving. 取得或設定儲存前是否計算試算表公式。

public bool EvaluateFormulasOnSave { get; set; }

Property Value

bool

ForceVersion

Gets or sets the ODF version to force into saved package metadata. 取得或設定儲存時要強制寫入封裝中繼資料的 ODF 版本。

public OdfVersion? ForceVersion { get; set; }

Property Value

OdfVersion?

IndentXml

Gets or sets a value indicating whether XML entries should be indented for diagnostics. 取得或設定是否為了診斷目的縮排 XML 專案。

public bool IndentXml { get; set; }

Property Value

bool

OpenPgpKeyProvider

Gets or sets the OpenPGP key provider used for ODF 1.3 package encryption. 取得或設定用於加密 ODF 1.3 OpenPGP 文件的金鑰提供者。

public IOdfOpenPgpKeyProvider? OpenPgpKeyProvider { get; set; }

Property Value

IOdfOpenPgpKeyProvider

OpenPgpRecipients

Gets the OpenPGP recipients supplied to the encryption provider. 取得提供給加密提供者的 OpenPGP 收件者描述。

public IList<OdfOpenPgpRecipient> OpenPgpRecipients { get; }

Property Value

IList<OdfOpenPgpRecipient>

Password

Gets or sets the password used to encrypt the saved ODF document. 取得或設定用於加密已儲存 ODF 文件的密碼。

public string? Password { get; set; }

Property Value

string

PruneUnusedMedia

Gets or sets a value indicating whether unreferenced Pictures/ media entries are removed on save. 取得或設定儲存時是否自動移除未被目前 DOM 參照的 Pictures/ 媒體專案。

public bool PruneUnusedMedia { get; set; }

Property Value

bool

Remarks

此選項只影響高階 OdfDocument 儲存管線;直接使用 OdfPackage 儲存時, 請改用 PruneUnusedMedia(IEnumerable<string>) 手動傳入目前文件實際參照的媒體路徑清單。

TemporaryDirectory

Gets or sets the temporary directory used by atomic save operations. 取得或設定原子化儲存作業使用的暫存目錄。

public string? TemporaryDirectory { get; set; }

Property Value

string

Remarks

When null, the system temporary directory is used. 若為 null,則使用系統暫存目錄。