API Reference
OdfDocument
Common package lifecycle for ODT, ODS, and ODP documents.
Inheritance
- Object
- OdfDocument
Usage
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by
- Method OdfDocument.Load
- Method OdfDocument.Load
- Method OdfDocument.LoadAsync
- Method OdfDocument.LoadAsync
- Method OdfDocument.LoadFlatXml
- Method OdfDocument.LoadFlatXml
Methods
public Byte[] GetPackageEntryBytes(String path) #Byte[]Returns a defensive copy of one already-loaded package entry without resolving external links.
Parameters
- path System.String
public OdfFeatureReport InspectFeatures() #OdfFeatureReportInspects supported, preserved, and unsupported document features.
public static OdfDocument Load(String path, OdfLoadOptions options = null) #OdfDocumentLoads an ODT, ODS, or ODP package and returns its native document type.
Parameters
- path System.String
- options OfficeIMO.OpenDocument.OdfLoadOptions = null
public static OdfDocument Load(Stream stream, OdfLoadOptions options = null) #OdfDocumentLoads an ODT, ODS, or ODP stream and returns its native document type.
Parameters
- stream System.IO.Stream
- options OfficeIMO.OpenDocument.OdfLoadOptions = null
public static async Task<OdfDocument> LoadAsync(String path, OdfLoadOptions options = null, CancellationToken cancellationToken = null) #Task<OdfDocument>Asynchronously loads an ODT, ODS, or ODP package from a path.
Parameters
- path System.String
- options OfficeIMO.OpenDocument.OdfLoadOptions = null
- cancellationToken System.Threading.CancellationToken = null
public static async Task<OdfDocument> LoadAsync(Stream stream, OdfLoadOptions options = null, CancellationToken cancellationToken = null) #Task<OdfDocument>Asynchronously loads an ODT, ODS, or ODP package from a caller-owned stream.
Parameters
- stream System.IO.Stream
- options OfficeIMO.OpenDocument.OdfLoadOptions = null
- cancellationToken System.Threading.CancellationToken = null
public static OdfDocument LoadFlatXml(Stream stream, OdfLoadOptions options = null) #OdfDocumentLoads a flat ODT, ODS, or ODP XML document.
Parameters
- stream System.IO.Stream
- options OfficeIMO.OpenDocument.OdfLoadOptions = null
public static OdfDocument LoadFlatXml(String path, OdfLoadOptions options = null) #OdfDocumentLoads a flat ODT, ODS, or ODP XML document from a path.
Parameters
- path System.String
- options OfficeIMO.OpenDocument.OdfLoadOptions = null
public OdfSaveResult Save(OdfSaveOptions options = null) #OdfSaveResultSaves to the current path and returns the serialized bytes with entry-level diagnostics.
Parameters
- options OfficeIMO.OpenDocument.OdfSaveOptions = null
public OdfSaveResult Save(String path, OdfSaveOptions options = null) #OdfSaveResultSaves to a path and returns the serialized bytes with entry-level diagnostics.
Parameters
- path System.String
- options OfficeIMO.OpenDocument.OdfSaveOptions = null
public OdfSaveResult Save(Stream destination, OdfSaveOptions options = null) #OdfSaveResultWrites to a stream and returns the serialized bytes with entry-level diagnostics.
Parameters
- destination System.IO.Stream
- options OfficeIMO.OpenDocument.OdfSaveOptions = null
public Task<OdfSaveResult> SaveAsync(CancellationToken cancellationToken = null) #Task<OdfSaveResult>Asynchronously saves to the original path used to load or first save the document.
Parameters
- cancellationToken System.Threading.CancellationToken = null
public Task<OdfSaveResult> SaveAsync(OdfSaveOptions options, CancellationToken cancellationToken = null) #Task<OdfSaveResult>Asynchronously saves to the original path with optional save settings.
Parameters
- options OfficeIMO.OpenDocument.OdfSaveOptions
- cancellationToken System.Threading.CancellationToken = null
public async Task<OdfSaveResult> SaveAsync(String path, OdfSaveOptions options = null, CancellationToken cancellationToken = null) #Task<OdfSaveResult>Asynchronously saves to a path and returns the serialized bytes with entry-level diagnostics.
Parameters
- path System.String
- options OfficeIMO.OpenDocument.OdfSaveOptions = null
- cancellationToken System.Threading.CancellationToken = null
public async Task<OdfSaveResult> SaveAsync(Stream destination, OdfSaveOptions options = null, CancellationToken cancellationToken = null) #Task<OdfSaveResult>Asynchronously writes to a stream and returns the serialized bytes with entry-level diagnostics.
Parameters
- destination System.IO.Stream
- options OfficeIMO.OpenDocument.OdfSaveOptions = null
- cancellationToken System.Threading.CancellationToken = null
public OdfSaveResult SaveCopy(String path, OdfSaveOptions options = null) #OdfSaveResultSaves an independent copy and returns entry-level diagnostics without changing the associated path.
Parameters
- path System.String
- options OfficeIMO.OpenDocument.OdfSaveOptions = null
public async Task<OdfSaveResult> SaveCopyAsync(String path, OdfSaveOptions options = null, CancellationToken cancellationToken = null) #Task<OdfSaveResult>Asynchronously saves an independent copy and returns entry-level diagnostics without changing the associated path.
Parameters
- path System.String
- options OfficeIMO.OpenDocument.OdfSaveOptions = null
- cancellationToken System.Threading.CancellationToken = null
public OdfSaveResult SaveFlatXml(Stream destination) #OdfSaveResultWrites flat OpenDocument XML and returns the serialized bytes with projection diagnostics.
Parameters
- destination System.IO.Stream
public OdfSaveResult SaveFlatXml(String path) #OdfSaveResultWrites flat OpenDocument XML to a path and returns the serialized bytes with projection diagnostics.
Parameters
- path System.String
public OdfSaveResult Serialize(OdfSaveOptions options = null) #OdfSaveResultSerializes without accepting the current dirty state and returns the bytes with entry-level diagnostics.
Parameters
- options OfficeIMO.OpenDocument.OdfSaveOptions = null
public Byte[] ToBytes(OdfSaveOptions options = null) #Byte[]Serializes the document to a byte array.
Parameters
- options OfficeIMO.OpenDocument.OdfSaveOptions = null
public XDocument ToFlatXml() #XDocumentProjects this package into a single flat OpenDocument XML tree.
public MemoryStream ToStream(OdfSaveOptions options = null) #MemoryStreamSerializes the document in a new writable memory stream positioned at the beginning.
Parameters
- options OfficeIMO.OpenDocument.OdfSaveOptions = null
public OdfValidationResult Validate() #OdfValidationResultValidates package and supported semantic invariants.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public String FilePath { get; } #Gets the file path associated with the document, if any.
public OdfVersion Version { get; } #Source or current output version.
public OdfDocumentMetadata Metadata { get; } #Document metadata.
public OdfStyleRepository Styles { get; } #Named and automatic styles stored in the document.
public IReadOnlyList<OdfDiagnostic> Diagnostics { get; } #Non-fatal diagnostics produced while opening the package.
public IReadOnlyList<String> PackageEntries { get; } #Package entry paths currently stored in the document.