# OdfDocument

Common package lifecycle for ODT, ODS, and ODP documents.

Class 

`OfficeIMO.OpenDocument`

**Namespace**

`OfficeIMO.OpenDocument`

**Assembly**

`OfficeIMO.OpenDocument`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[OdfDocument.cs:9](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L9)

**Implements**

`IDisposable`

**Modifiers**

abstract

Common package lifecycle for ODT, ODS, and ODP documents.

## Inheritance

- object
- OdfDocument

## Derived Types

- [OdgDocument](/api/open-document/officeimo-opendocument-odgdocument/)
- [OdpPresentation](/api/open-document/officeimo-opendocument-odppresentation/)
- [OdsDocument](/api/open-document/officeimo-opendocument-odsdocument/)
- [OdtDocument](/api/open-document/officeimo-opendocument-odtdocument/)

## Guides & Samples

Authored walkthroughs and practical samples linked to this API.

- [Create and Read ODT, ODS and ODP Files](/docs/open-document/create-read/) Guide
  
  Create OpenDocument text, spreadsheet and presentation files, read their content, edit them in place, and open password-protected files.
- [OpenDocument](/docs/open-document/) Guide
  
  Create, read and edit ODT, ODS and ODP files in .NET without LibreOffice, and convert them to Word, Excel, PowerPoint and PDF with a report of anything lost.
- [Sign and Verify Office and ODF Files](/docs/security/sign-documents/) Guide
  
  Add digital signatures to DOCX, XLSX, PPTX and ODT/ODS/ODP files with OfficeIMO.Security, validate existing signatures, and set a trust policy.
- [Remove hidden data and metadata](/docs/before-sharing/hidden-data/) Guide
  
  Inspect and remove properties, comments, tracked changes, hidden content, notes, attachments, scripts and GPS data from Office, PDF, EPUB and image files.
- [Content Credentials and AI labels](/docs/before-sharing/provenance/) Guide
  
  Find C2PA Content Credentials and IPTC AI source labels in Office, Visio, OpenDocument and EPUB files and their pictures, and remove them selectively.

## Usage

Explore 4 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 4

- Method [OdfDocument.Create](/api/open-document/officeimo-opendocument-odfdocument/#method-create-officeimo-opendocument-odfdocumentkind-string)
- Method [OdfDocument.Load](/api/open-document/officeimo-opendocument-odfdocument/#method-load-string-officeimo-opendocument-odfloadoptions)
- Method [OdfDocument.LoadAsync](/api/open-document/officeimo-opendocument-odfdocument/#method-loadasync-string-officeimo-opendocument-odfloadoptions-threading-cancellationtoken)
- Method [OdfDocument.LoadFlatXml](/api/open-document/officeimo-opendocument-odfdocument/#method-loadflatxml-io-stream-officeimo-opendocument-odfloadoptions)

Filter members 

Show inherited

## Methods

`public static OdfDocument Create(OdfDocumentKind kind, string? path = null)` [#](#method-create-officeimo-opendocument-odfdocumentkind-string)

[OdfDocument.cs:9](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L9)

Creates an empty ODF 1.4 model with an optional associated save path, without writing a file.

Parameters

**kind OfficeIMO.OpenDocument.OdfDocumentKind required**

**path string? = null optional**

Returns

`OdfDocument`

`public void Dispose()` [#](#method-dispose)

[OdfDocument.Lifecycle.cs:6](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.Lifecycle.cs#L6)

Completes the document lifecycle without saving.

`public IReadOnlyList<OfficeEmbeddedPayloadInfo> GetEmbeddedPayloads(OfficeEmbeddedPayloadInspectionOptions options, CancellationToken cancellationToken = default)` [#](#method-getembeddedpayloads-officeimo-officeembeddedpayloadinspectionoptions-threading-cancellationtoken)

[OdfDocument.EmbeddedPayloads.cs:12](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.EmbeddedPayloads.cs#L12)

Returns native non-XML payload descriptors under explicit inspection limits.

Parameters

**options OfficeIMO.OfficeEmbeddedPayloadInspectionOptions required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`IReadOnlyList<OfficeEmbeddedPayloadInfo>`

`public long GetPackageEntryByteLength(string reference)` [#](#method-getpackageentrybytelength-string)

[OdfDocument.PackageEntries.cs:21](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.PackageEntries.cs#L21)

Decoded or declared byte length of a package entry without expanding a deferred binary payload.

Parameters

**reference string required**

Returns

`long`

GetPackageEntryBytes 2 overloads

`public byte[] GetPackageEntryBytes(string path)` [#](#method-getpackageentrybytes-string)

[OdfDocument.PackageEntries.cs:28](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.PackageEntries.cs#L28)

Returns a defensive copy of one already-loaded package entry without resolving external links.

Parameters

**path string required**

Returns

`byte[]`

`public byte[] GetPackageEntryBytes(string path, long maximumBytes)` [#](#method-getpackageentrybytes-string-int64)

[OdfDocument.PackageEntries.cs:32](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.PackageEntries.cs#L32)

Returns an already-loaded entry within an explicit byte ceiling, checked before creating its defensive copy. External links are never resolved.

Parameters

**path string required**

**maximumBytes long required**

Returns

`byte[]`

`public string? GetPackageEntryMediaType(string reference)` [#](#method-getpackageentrymediatype-string)

[OdfDocument.PackageEntries.cs:18](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.PackageEntries.cs#L18)

Declared media type of an already-loaded package entry. External references are never fetched.

Parameters

**reference string required**

Returns

`string?`

`public OdfPackageEntryPayloadState GetPackageEntryPayloadState(string reference)` [#](#method-getpackageentrypayloadstate-string)

[OdfDocument.PackageEntries.cs:25](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.PackageEntries.cs#L25)

Reports whether native entry bytes are deferred, fully loaded or checked by the supported ODF decryption profile.

Parameters

**reference string required**

Returns

`OdfPackageEntryPayloadState`

InspectContentSafety 2 overloads

`public static OfficeContentSafetyReport InspectContentSafety(byte[] documentBytes, OfficeContentSafetyOptions? options = null, OdfLoadOptions? loadOptions = null)` [#](#method-inspectcontentsafety-byte-officeimo-contentsafety-officecontentsafetyoptions-officeimo-opendocument-odfloadoptions)

[OdfDocument.ContentSafety.cs:13](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.ContentSafety.cs#L13)

Inspects ODT, ODS, or ODP native visibility, geometry, contrast, notes, comments, and Unicode evidence.

Parameters

**documentBytes byte[] required**

**options OfficeIMO.ContentSafety.OfficeContentSafetyOptions? = null optional**

**loadOptions OfficeIMO.OpenDocument.OdfLoadOptions? = null optional**

Returns

`OfficeContentSafetyReport`

`public static OfficeContentSafetyReport InspectContentSafety(string filePath, OfficeContentSafetyOptions? options = null, OdfLoadOptions? loadOptions = null)` [#](#method-inspectcontentsafety-string-officeimo-contentsafety-officecontentsafetyoptions-officeimo-opendocument-odfloadoptions)

[OdfDocument.ContentSafety.cs:26](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.ContentSafety.cs#L26)

Inspects an OpenDocument package without treating concealment as evidence of AI authorship.

Parameters

**filePath string required**

**options OfficeIMO.ContentSafety.OfficeContentSafetyOptions? = null optional**

**loadOptions OfficeIMO.OpenDocument.OdfLoadOptions? = null optional**

Returns

`OfficeContentSafetyReport`

`public OfficeEmbeddedPayloadInspection InspectEmbeddedPayloads(OfficeEmbeddedPayloadInspectionOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-inspectembeddedpayloads-officeimo-officeembeddedpayloadinspectionoptions-threading-cancellationtoken)

[OdfDocument.EmbeddedPayloads.cs:7](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.EmbeddedPayloads.cs#L7)

Inventories inert non-XML package payloads without expanding deferred entries unless hashing is requested. The session snapshots native entry identities and content sources; later edits do not replace its selected bytes.

Parameters

**options OfficeIMO.OfficeEmbeddedPayloadInspectionOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`OfficeEmbeddedPayloadInspection`

InspectFeatures 2 overloads

`public OdfFeatureReport InspectFeatures()` [#](#method-inspectfeatures)

[OdfDocument.cs:176](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L176)

Inspects supported, preserved, and unsupported document features.

Returns

`OdfFeatureReport`

`public OdfFeatureReport InspectFeatures(CancellationToken cancellationToken)` [#](#method-inspectfeatures-threading-cancellationtoken)

[OdfDocument.cs:180](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L180)

Inspects native package features with cancellation between XML parts, without executing preserved content.

Parameters

**cancellationToken System.Threading.CancellationToken required**

Returns

`OdfFeatureReport`

`public OfficeHiddenDataReport InspectHiddenData()` [#](#method-inspecthiddendata)

[OdfDocument.HiddenData.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.HiddenData.cs#L15)

Finds metadata, personal information and hidden data without changing the document.

Returns

`OfficeHiddenDataReport`

`public OfficeContentSafetyReport InspectLoadedContentSafety(OfficeContentSafetyOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-inspectloadedcontentsafety-officeimo-contentsafety-officecontentsafetyoptions-threading-cancellationtoken)

[OdfDocument.InspectionEvidence.cs:8](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.InspectionEvidence.cs#L8)

Inspects the loaded native package without serialization, external-resource access, or mutation. Source-load limits remain the caller's responsibility.

Parameters

**options OfficeIMO.ContentSafety.OfficeContentSafetyOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`OfficeContentSafetyReport`

Load 2 overloads

`public static OdfDocument Load(string path, OdfLoadOptions? options = null)` [#](#method-load-string-officeimo-opendocument-odfloadoptions)

[OdfDocument.cs:26](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L26)

Loads an ODT, ODS, or ODP package and returns its native document type.

Parameters

**path string required**

**options OfficeIMO.OpenDocument.OdfLoadOptions? = null optional**

Returns

`OdfDocument`

`public static OdfDocument Load(Stream stream, OdfLoadOptions? options = null)` [#](#method-load-io-stream-officeimo-opendocument-odfloadoptions)

[OdfDocument.cs:32](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L32)

Loads an ODT, ODS, or ODP stream and returns its native document type.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.OpenDocument.OdfLoadOptions? = null optional**

Returns

`OdfDocument`

LoadAsync 2 overloads

`public static async Task<OdfDocument> LoadAsync(string path, OdfLoadOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-loadasync-string-officeimo-opendocument-odfloadoptions-threading-cancellationtoken)

Asynchronously loads an ODT, ODS, or ODP package from a path.

Parameters

**path string required**

**options OfficeIMO.OpenDocument.OdfLoadOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<OdfDocument>`

`public static async Task<OdfDocument> LoadAsync(Stream stream, OdfLoadOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-loadasync-io-stream-officeimo-opendocument-odfloadoptions-threading-cancellationtoken)

Asynchronously loads an ODT, ODS, or ODP package from a caller-owned stream.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.OpenDocument.OdfLoadOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<OdfDocument>`

LoadFlatXml 2 overloads

`public static OdfDocument LoadFlatXml(Stream stream, OdfLoadOptions? options = null)` [#](#method-loadflatxml-io-stream-officeimo-opendocument-odfloadoptions)

[OdfDocument.FlatXml.cs:54](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.FlatXml.cs#L54)

Loads a flat ODT, ODS, ODP, or ODG XML document.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.OpenDocument.OdfLoadOptions? = null optional**

Returns

`OdfDocument`

`public static OdfDocument LoadFlatXml(string path, OdfLoadOptions? options = null)` [#](#method-loadflatxml-string-officeimo-opendocument-odfloadoptions)

[OdfDocument.FlatXml.cs:64](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.FlatXml.cs#L64)

Loads a flat ODT, ODS, ODP, or ODG XML document from a path.

Parameters

**path string required**

**options OfficeIMO.OpenDocument.OdfLoadOptions? = null optional**

Returns

`OdfDocument`

`public static string NormalizePackageEntryPath(string reference)` [#](#method-normalizepackageentrypath-string)

[OdfDocument.PackageEntries.cs:13](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.PackageEntries.cs#L13)

Normalizes a package reference through the native owner without fetching or resolving filesystem targets.

Parameters

**reference string required**

Returns

`string`

`public Stream OpenEmbeddedPayload(string id, long maximumBytes, CancellationToken cancellationToken = default)` [#](#method-openembeddedpayload-string-int64-threading-cancellationtoken)

[OdfDocument.EmbeddedPayloads.cs:19](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.EmbeddedPayloads.cs#L19)

Reads one complete inert non-XML native package payload under an explicit decoded byte ceiling.

Parameters

**id string required**

**maximumBytes long required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Stream`

`public OfficeHiddenDataReport RemoveHiddenData(OfficeHiddenDataOptions? options = null)` [#](#method-removehiddendata-officeimo-officehiddendataoptions)

[OdfDocument.HiddenData.cs:20](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.HiddenData.cs#L20)

Removes the selected categories of metadata and hidden data, then reports what was found and what happened to each item. Save the document to keep the result.

Parameters

**options OfficeIMO.OfficeHiddenDataOptions? = null optional**

Categories to remove; defaults to OfficeHiddenDataKind.Default, which keeps tracked changes, hidden content and provenance.

Returns

`OfficeHiddenDataReport`

RemoveProvenance 2 overloads

`public static OfficeProvenanceRemovalResult RemoveProvenance(string inputPath, string outputPath, OfficeProvenanceRemovalOptions? options = null)` [#](#method-removeprovenance-string-string-officeimo-provenance-officeprovenanceremovaloptions)

[OdfDocument.Provenance.cs:36](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.Provenance.cs#L36)

Removes selected provenance and atomically writes an ODF package.

Parameters

**inputPath string required**

**outputPath string required**

**options OfficeIMO.Provenance.OfficeProvenanceRemovalOptions? = null optional**

Returns

`OfficeProvenanceRemovalResult`

`public static OfficeProvenanceRemovalResult RemoveProvenance(byte[] packageBytes, string fileName = "document.odt", OfficeProvenanceRemovalOptions? options = null)` [#](#method-removeprovenance-byte-string-officeimo-provenance-officeprovenanceremovaloptions)

[OdfDocument.Provenance.cs:51](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.Provenance.cs#L51)

Removes selected provenance from encoded ODF package bytes.

Parameters

**packageBytes byte[] required**

**fileName string = "document.odt" optional**

**options OfficeIMO.Provenance.OfficeProvenanceRemovalOptions? = null optional**

Returns

`OfficeProvenanceRemovalResult`

RemoveSelectedContent 2 overloads

`public static OfficeContentCleanupResult RemoveSelectedContent(byte[] documentBytes, OfficeContentCleanupSelection selection, OfficeContentCleanupOptions? options = null, OdfLoadOptions? loadOptions = null)` [#](#method-removeselectedcontent-byte-officeimo-contentsafety-officecontentcleanupselection-officeimo-contentsafety-officecontentcleanupoptions-officeimo-opendocument-odfloadoptions)

[OdfDocument.ContentSafety.cs:37](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.ContentSafety.cs#L37)

Removes exact selected OpenDocument text nodes and verifies the preservation-aware rewritten package.

Parameters

**documentBytes byte[] required**

**selection OfficeIMO.ContentSafety.OfficeContentCleanupSelection required**

**options OfficeIMO.ContentSafety.OfficeContentCleanupOptions? = null optional**

**loadOptions OfficeIMO.OpenDocument.OdfLoadOptions? = null optional**

Returns

`OfficeContentCleanupResult`

`public static OfficeContentCleanupResult RemoveSelectedContent(string inputPath, string outputPath, OfficeContentCleanupSelection selection, OfficeContentCleanupOptions? options = null, OdfLoadOptions? loadOptions = null)` [#](#method-removeselectedcontent-string-string-officeimo-contentsafety-officecontentcleanupselection-officeimo-contentsafety-officecontentcleanupoptions-officeimo-opendocument-odfloadoptions)

[OdfDocument.ContentSafety.cs:77](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.ContentSafety.cs#L77)

Atomically writes an explicitly cleaned OpenDocument artifact.

Parameters

**inputPath string required**

**outputPath string required**

**selection OfficeIMO.ContentSafety.OfficeContentCleanupSelection required**

**options OfficeIMO.ContentSafety.OfficeContentCleanupOptions? = null optional**

**loadOptions OfficeIMO.OpenDocument.OdfLoadOptions? = null optional**

Returns

`OfficeContentCleanupResult`

Save 3 overloads

`public OdfSaveResult Save(OdfSaveOptions? options = null)` [#](#method-save-officeimo-opendocument-odfsaveoptions)

[OdfDocument.cs:79](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L79)

Saves to the current path and returns the serialized bytes with entry-level diagnostics.

Parameters

**options OfficeIMO.OpenDocument.OdfSaveOptions? = null optional**

Returns

`OdfSaveResult`

`public OdfSaveResult Save(string path, OdfSaveOptions? options = null)` [#](#method-save-string-officeimo-opendocument-odfsaveoptions)

[OdfDocument.cs:85](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L85)

Saves to a path and returns the serialized bytes with entry-level diagnostics.

Parameters

**path string required**

**options OfficeIMO.OpenDocument.OdfSaveOptions? = null optional**

Returns

`OdfSaveResult`

`public OdfSaveResult Save(Stream destination, OdfSaveOptions? options = null)` [#](#method-save-io-stream-officeimo-opendocument-odfsaveoptions)

[OdfDocument.cs:105](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L105)

Writes to a stream and returns the serialized bytes with entry-level diagnostics.

Parameters

**destination System.IO.Stream required**

**options OfficeIMO.OpenDocument.OdfSaveOptions? = null optional**

Returns

`OdfSaveResult`

SaveAsync 4 overloads

`public Task<OdfSaveResult> SaveAsync(CancellationToken cancellationToken = default)` [#](#method-saveasync-threading-cancellationtoken)

[OdfDocument.cs:113](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L113)

Asynchronously saves to the original path used to load or first save the document.

Parameters

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<OdfSaveResult>`

`public Task<OdfSaveResult> SaveAsync(OdfSaveOptions? options, CancellationToken cancellationToken = default)` [#](#method-saveasync-officeimo-opendocument-odfsaveoptions-threading-cancellationtoken)

[OdfDocument.cs:117](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L117)

Asynchronously saves to the original path with optional save settings.

Parameters

**options OfficeIMO.OpenDocument.OdfSaveOptions? required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<OdfSaveResult>`

`public async Task<OdfSaveResult> SaveAsync(string path, OdfSaveOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-saveasync-string-officeimo-opendocument-odfsaveoptions-threading-cancellationtoken)

Asynchronously saves to a path and returns the serialized bytes with entry-level diagnostics.

Parameters

**path string required**

**options OfficeIMO.OpenDocument.OdfSaveOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<OdfSaveResult>`

`public async Task<OdfSaveResult> SaveAsync(Stream destination, OdfSaveOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-saveasync-io-stream-officeimo-opendocument-odfsaveoptions-threading-cancellationtoken)

Asynchronously writes to a stream and returns the serialized bytes with entry-level diagnostics.

Parameters

**destination System.IO.Stream required**

**options OfficeIMO.OpenDocument.OdfSaveOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<OdfSaveResult>`

`public OdfSaveResult SaveCopy(string path, OdfSaveOptions? options = null)` [#](#method-savecopy-string-officeimo-opendocument-odfsaveoptions)

[OdfDocument.cs:96](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L96)

Saves an independent copy and returns entry-level diagnostics without changing the associated path.

Parameters

**path string required**

**options OfficeIMO.OpenDocument.OdfSaveOptions? = null optional**

Returns

`OdfSaveResult`

`public async Task<OdfSaveResult> SaveCopyAsync(string path, OdfSaveOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-savecopyasync-string-officeimo-opendocument-odfsaveoptions-threading-cancellationtoken)

Asynchronously saves an independent copy and returns entry-level diagnostics without changing the associated path.

Parameters

**path string required**

**options OfficeIMO.OpenDocument.OdfSaveOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<OdfSaveResult>`

SaveFlatXml 2 overloads

`public OdfSaveResult SaveFlatXml(Stream destination)` [#](#method-saveflatxml-io-stream)

[OdfDocument.FlatXml.cs:36](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.FlatXml.cs#L36)

Writes flat OpenDocument XML and returns the serialized bytes with projection diagnostics.

Parameters

**destination System.IO.Stream required**

Returns

`OdfSaveResult`

`public OdfSaveResult SaveFlatXml(string path)` [#](#method-saveflatxml-string)

[OdfDocument.FlatXml.cs:44](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.FlatXml.cs#L44)

Writes flat OpenDocument XML to a path and returns the serialized bytes with projection diagnostics.

Parameters

**path string required**

Returns

`OdfSaveResult`

`public OdfSaveResult Serialize(OdfSaveOptions? options = null)` [#](#method-serialize-officeimo-opendocument-odfsaveoptions)

[OdfDocument.cs:165](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L165)

Serializes without accepting the current dirty state and returns the bytes with entry-level diagnostics.

Parameters

**options OfficeIMO.OpenDocument.OdfSaveOptions? = null optional**

Returns

`OdfSaveResult`

`public static OfficeXmlPackageSigningResult SignPackage(string filePath, IOfficeSecurityProvider securityProvider, X509Certificate2 signingCertificate, OfficeXmlPackageSignatureOptions? options = null)` [#](#method-signpackage-string-officeimo-security-iofficesecurityprovider-security-cryptography-x509certificates-x509certificate2-officeimo-security-officexmlpackagesignatureoptions)

[OdfDocument.Signatures.cs:21](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.Signatures.cs#L21)

Creates, validates, and atomically commits an ODF XML package signature.

Parameters

**filePath string required**

**securityProvider OfficeIMO.Security.IOfficeSecurityProvider required**

**signingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2 required**

**options OfficeIMO.Security.OfficeXmlPackageSignatureOptions? = null optional**

Returns

`OfficeXmlPackageSigningResult`

`public byte[] ToBytes(OdfSaveOptions? options = null)` [#](#method-tobytes-officeimo-opendocument-odfsaveoptions)

[OdfDocument.cs:153](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L153)

Serializes the document to a byte array.

Parameters

**options OfficeIMO.OpenDocument.OdfSaveOptions? = null optional**

Returns

`byte[]`

`public XDocument ToFlatXml()` [#](#method-toflatxml)

[OdfDocument.FlatXml.cs:8](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.FlatXml.cs#L8)

Projects this package into a single flat OpenDocument XML tree.

Returns

`XDocument`

`public static OfficeXmlPackageSigningResult TrySignPackage(string filePath, IOfficeSecurityProvider securityProvider, X509Certificate2 signingCertificate, OfficeXmlPackageSignatureOptions? options = null)` [#](#method-trysignpackage-string-officeimo-security-iofficesecurityprovider-security-cryptography-x509certificates-x509certificate2-officeimo-security-officexmlpackagesignatureoptions)

[OdfDocument.Signatures.cs:31](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.Signatures.cs#L31)

Attempts atomic ODF XML signature creation and returns structured failure evidence.

Parameters

**filePath string required**

**securityProvider OfficeIMO.Security.IOfficeSecurityProvider required**

**signingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2 required**

**options OfficeIMO.Security.OfficeXmlPackageSignatureOptions? = null optional**

Returns

`OfficeXmlPackageSigningResult`

`public OdfValidationResult Validate()` [#](#method-validate)

[OdfDocument.cs:171](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L171)

Validates package and supported semantic invariants.

Returns

`OdfValidationResult`

`public static OfficeXmlPackageSignatureValidationReport ValidateSignatures(string filePath, IOfficeSecurityProvider securityProvider, OfficeXmlPackageSignatureOptions? options = null)` [#](#method-validatesignatures-string-officeimo-security-iofficesecurityprovider-officeimo-security-officexmlpackagesignatureoptions)

[OdfDocument.Signatures.cs:12](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.Signatures.cs#L12)

Validates META-INF/documentsignatures.xml and signed package-entry digests through an explicit provider.

Parameters

**filePath string required**

**securityProvider OfficeIMO.Security.IOfficeSecurityProvider required**

**options OfficeIMO.Security.OfficeXmlPackageSignatureOptions? = null optional**

Returns

`OfficeXmlPackageSignatureValidationReport`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public OdfDocumentKind Kind { get; }` [#](#property-kind)

[OdfDocument.cs:64](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L64)

Document kind.

`public string? FilePath { get; }` [#](#property-filepath)

[OdfDocument.cs:66](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L66)

Gets the file path associated with the document, if any.

`public OdfVersion Version { get; }` [#](#property-version)

[OdfDocument.cs:68](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L68)

Source or current output version.

`public OdfDocumentMetadata Properties { get; }` [#](#property-properties)

[OdfDocument.cs:70](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L70)

Standard and user-defined document properties stored in meta.xml.

`public OdfStyleRepository Styles { get; }` [#](#property-styles)

[OdfDocument.cs:72](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L72)

Named and automatic styles stored in the document.

`public IReadOnlyList<OdfDiagnostic> Diagnostics { get; }` [#](#property-diagnostics)

[OdfDocument.cs:74](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L74)

Non-fatal diagnostics produced while opening the package.

`public OdfSecurityInfo Security { get; }` [#](#property-security)

[OdfDocument.cs:76](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.cs#L76)

Password-protection state for the package loaded or most recently saved.

`public IReadOnlyList<string> PackageEntries { get; }` [#](#property-packageentries)

[OdfDocument.PackageEntries.cs:5](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.PackageEntries.cs#L5)

Package entry paths currently stored in the document.

`public IReadOnlyList<string> BinaryPayloadEntries { get; }` [#](#property-binarypayloadentries)

[OdfDocument.PackageEntries.cs:8](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Core/OdfDocument.PackageEntries.cs#L8)

Native non-XML/control payload paths in package order; excludes directory records, mimetype, XML and RDF metadata parts.

<!-- PowerForge markdown artifact sha256:FE11BB48D376AB441B570B98FEF310930159F8820DBA2A7D6A4519142E11F860 -->
