API Reference
OdgDocument
An XML-backed OpenDocument drawing with editable pages and preserved package content.
Inheritance
- OdfDocument
- OdgDocument
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 OdgDocument.Create
- Method OdgDocument.Load
- Method OdgDocument.Load
- Method OdgDocument.LoadAsync
- Method OdgDocument.LoadAsync
- Method OdgDocument.LoadFlatXml
- Method OdgDocument.LoadFlatXml
Accepted by parameters
- Method OdgDocument.ImportPage
Methods
public OdgPage AddPage(String name = null, Nullable<OdfLength> width = null, Nullable<OdfLength> height = null) #OdgPageAdds a page with its own layout and master. Dimensions default to A4 portrait.
Parameters
- name System.String = null
- width System.Nullable{OfficeIMO.OpenDocument.OdfLength} = null
- height System.Nullable{OfficeIMO.OpenDocument.OdfLength} = null
public String CloneMasterPage(String sourceName, String name = null) #StringClones a master and its page layout in this drawing and returns its unique native name. Artwork and layers are copied; styles and immutable image entries remain shared. Assign the result to a page's MasterPageName to use the independent layout and layer set.
Parameters
- sourceName System.String
- Existing, unambiguous master name.
- name System.String = null
- Unique destination name; null generates a name from the source master.
Exceptions
NotSupportedException– The master contains content outside the page-cloning profile.InvalidDataException– The source master or page layout is missing or ambiguous.
public OdgPage ClonePage(Int32 sourceIndex, String name = null) #OdgPageAppends a copy of a page in this drawing, remapping native identifiers and local references. Styles, immutable image entries and the master are shared. Clone the master separately for independent layout edits.
Parameters
- sourceIndex System.Int32
- Zero-based source page position.
- name System.String = null
- Unique destination name; null generates a name from the source page.
Exceptions
NotSupportedException– The page contains embedded editable objects, forms, animations or named text definitions.InvalidDataException– Identifiers or local attachment references are ambiguous or unresolved.
public OdgPage ImportPage(OdgDocument source, Int32 sourceIndex, String name = null) #OdgPageAppends a page from another drawing, with independent master/layout, reachable styles and embedded resources. Native identifiers are remapped. Unsupported content or unresolved dependencies fail before changing either document.
Parameters
- source OfficeIMO.OpenDocument.OdgDocument
- A different drawing, loaded from ODG or FODG.
- sourceIndex System.Int32
- Zero-based source page position.
- name System.String = null
- Unique destination name; null generates a name from the source page.
Exceptions
NotSupportedException– Content or default-style inheritance cannot be transferred without changing its meaning.InvalidDataException– A required master, layout, style, resource or reference is missing or ambiguous.
public static OdgDocument Load(String path, OdfLoadOptions options = null) #OdgDocumentLoads an ODG package from a path.
Parameters
- path System.String
- options OfficeIMO.OpenDocument.OdfLoadOptions = null
public static OdgDocument Load(Stream stream, OdfLoadOptions options = null) #OdgDocumentLoads an ODG package from a caller-owned stream.
Parameters
- stream System.IO.Stream
- options OfficeIMO.OpenDocument.OdfLoadOptions = null
public static async Task<OdgDocument> LoadAsync(String path, OdfLoadOptions options = null, CancellationToken cancellationToken = default) #Task<OdgDocument>Asynchronously loads an ODG package from a path.
Parameters
- path System.String
- options OfficeIMO.OpenDocument.OdfLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public static async Task<OdgDocument> LoadAsync(Stream stream, OdfLoadOptions options = null, CancellationToken cancellationToken = default) #Task<OdgDocument>Asynchronously loads an ODG package from a caller-owned stream.
Parameters
- stream System.IO.Stream
- options OfficeIMO.OpenDocument.OdfLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public static OdgDocument LoadFlatXml(String path, OdfLoadOptions options = null) #OdgDocumentLoads a flat OpenDocument drawing (FODG).
Parameters
- path System.String
- options OfficeIMO.OpenDocument.OdfLoadOptions = null
public static OdgDocument LoadFlatXml(Stream stream, OdfLoadOptions options = null) #OdgDocumentLoads FODG from a caller-owned stream.
Parameters
- stream System.IO.Stream
- options OfficeIMO.OpenDocument.OdfLoadOptions = null
public Void MovePage(Int32 sourceIndex, Int32 destinationIndex) #VoidMoves a page to a zero-based position.
Parameters
- sourceIndex System.Int32
- destinationIndex System.Int32
public Void RemovePage(Int32 index) #VoidRemoves a page at a zero-based position.
Parameters
- index System.Int32
public OdfConversionResult<IReadOnlyList<OfficeDrawing>> ToDrawings(OdfConversionLossPolicy lossPolicy = ReportOnly, Boolean forPrint = false, Int32 maximumPages = 1000, CancellationToken cancellationToken = default) #OdfConversionResult<IReadOnlyList<OfficeDrawing>>Projects every Draw page in document order with page-qualified feature losses.
Parameters
- lossPolicy OfficeIMO.OpenDocument.OdfConversionLossPolicy = ReportOnly
- Treatment of unsupported content and approximations.
- forPrint System.Boolean = false
- Selects print-visible layers instead of screen-visible layers.
- maximumPages System.Int32 = 1000
- Maximum source page count accepted before projecting any page.
- cancellationToken System.Threading.CancellationToken = default
- Cooperative cancellation between pages and shapes.
public OdfConversionResult<IReadOnlyList<OfficeDrawing>> ToDrawings(OdfConversionLossPolicy lossPolicy, Boolean forPrint, Int32 maximumPages, CancellationToken cancellationToken, OdfDateTimeFieldProjectionOptions dateTimeFields) #OdfConversionResult<IReadOnlyList<OfficeDrawing>>Projects all pages using one explicit date/time field settings snapshot.
Parameters
- lossPolicy OfficeIMO.OpenDocument.OdfConversionLossPolicy
- forPrint System.Boolean
- maximumPages System.Int32
- cancellationToken System.Threading.CancellationToken
- dateTimeFields OfficeIMO.OpenDocument.OdfDateTimeFieldProjectionOptions
public OdfConversionResult<IReadOnlyList<OfficeDrawing>> ToDrawings(OfficeRenderingProfile renderingProfile, OdfConversionLossPolicy lossPolicy = ReportOnly, Boolean forPrint = false, Int32 maximumPages = 1000, CancellationToken cancellationToken = default, OdfDateTimeFieldProjectionOptions dateTimeFields = null) #OdfConversionResult<IReadOnlyList<OfficeDrawing>>Projects pages using caller-supplied fonts and shaping for both layout decisions and the returned drawings.
Parameters
- renderingProfile OfficeIMO.Drawing.OfficeRenderingProfile
- lossPolicy OfficeIMO.OpenDocument.OdfConversionLossPolicy = ReportOnly
- forPrint System.Boolean = false
- maximumPages System.Int32 = 1000
- cancellationToken System.Threading.CancellationToken = default
- dateTimeFields OfficeIMO.OpenDocument.OdfDateTimeFieldProjectionOptions = null
Inherited Methods
public virtual Boolean Equals(Object obj) #BooleanParameters
- obj Object
public Byte[] GetPackageEntryBytes(String path) #Byte[]Parameters
- path String
public OdfSaveResult Save(OdfSaveOptions options = null) #OdfSaveResultParameters
- options OdfSaveOptions = null
public OdfSaveResult Save(String path, OdfSaveOptions options = null) #OdfSaveResultParameters
- path String
- options OdfSaveOptions = null
public OdfSaveResult Save(Stream destination, OdfSaveOptions options = null) #OdfSaveResultParameters
- destination Stream
- options OdfSaveOptions = null
public Task<OdfSaveResult> SaveAsync(CancellationToken cancellationToken = default) #Task<OdfSaveResult>Parameters
- cancellationToken CancellationToken = default
public Task<OdfSaveResult> SaveAsync(OdfSaveOptions options, CancellationToken cancellationToken = default) #Task<OdfSaveResult>Parameters
- options OdfSaveOptions
- cancellationToken CancellationToken = default
public async Task<OdfSaveResult> SaveAsync(String path, OdfSaveOptions options = null, CancellationToken cancellationToken = default) #Task<OdfSaveResult>Parameters
- path String
- options OdfSaveOptions = null
- cancellationToken CancellationToken = default
public async Task<OdfSaveResult> SaveAsync(Stream destination, OdfSaveOptions options = null, CancellationToken cancellationToken = default) #Task<OdfSaveResult>Parameters
- destination Stream
- options OdfSaveOptions = null
- cancellationToken CancellationToken = default
public OdfSaveResult SaveCopy(String path, OdfSaveOptions options = null) #OdfSaveResultParameters
- path String
- options OdfSaveOptions = null
public async Task<OdfSaveResult> SaveCopyAsync(String path, OdfSaveOptions options = null, CancellationToken cancellationToken = default) #Task<OdfSaveResult>Parameters
- path String
- options OdfSaveOptions = null
- cancellationToken CancellationToken = default
public OdfSaveResult SaveFlatXml(Stream destination) #OdfSaveResultParameters
- destination Stream
public OdfSaveResult SaveFlatXml(String path) #OdfSaveResultParameters
- path String
public OdfSaveResult Serialize(OdfSaveOptions options = null) #OdfSaveResultParameters
- options OdfSaveOptions = null
public Byte[] ToBytes(OdfSaveOptions options = null) #Byte[]Parameters
- options OdfSaveOptions = null
public MemoryStream ToStream(OdfSaveOptions options = null) #MemoryStreamParameters
- options OdfSaveOptions = null
Properties
Inherited Properties
public OdfDocumentKind Kind { get; } #public String FilePath { get; } #public OdfVersion Version { get; } #public OdfDocumentMetadata Metadata { get; } #public OdfStyleRepository Styles { get; } #public IReadOnlyList<OdfDiagnostic> Diagnostics { get; } #public OdfSecurityInfo Security { get; } #public IReadOnlyList<String> PackageEntries { get; } #