Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

API Reference

Class

OdgDocument

Namespace OfficeIMO.OpenDocument
Assembly OfficeIMO.OpenDocument
Modifiers sealed

An XML-backed OpenDocument drawing with editable pages and preserved package content.

Inheritance

Usage

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

Accepted by parameters

Methods

public OdgPage AddPage(String name = null, Nullable<OdfLength> width = null, Nullable<OdfLength> height = null) #
Returns: OdgPage

Adds a page with its own layout and master. Dimensions default to A4 portrait.

Parameters

name System.String = null optionalposition: 0
width System.Nullable{OfficeIMO.OpenDocument.OdfLength} = null optionalposition: 1
height System.Nullable{OfficeIMO.OpenDocument.OdfLength} = null optionalposition: 2
public String CloneMasterPage(String sourceName, String name = null) #
Returns: String

Clones 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 requiredposition: 0
Existing, unambiguous master name.
name System.String = null optionalposition: 1
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) #
Returns: OdgPage

Appends 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 requiredposition: 0
Zero-based source page position.
name System.String = null optionalposition: 1
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 static OdgDocument Create() #
Returns: OdgDocument

Creates an empty ODF 1.4 drawing.

public OdgPage ImportPage(OdgDocument source, Int32 sourceIndex, String name = null) #
Returns: OdgPage

Appends 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 requiredposition: 0
A different drawing, loaded from ODG or FODG.
sourceIndex System.Int32 requiredposition: 1
Zero-based source page position.
name System.String = null optionalposition: 2
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.
Load 2 overloads
public static OdgDocument Load(String path, OdfLoadOptions options = null) #
Returns: OdgDocument

Loads an ODG package from a path.

Parameters

path System.String requiredposition: 0
options OfficeIMO.OpenDocument.OdfLoadOptions = null optionalposition: 1
public static OdgDocument Load(Stream stream, OdfLoadOptions options = null) #
Returns: OdgDocument

Loads an ODG package from a caller-owned stream.

Parameters

stream System.IO.Stream requiredposition: 0
options OfficeIMO.OpenDocument.OdfLoadOptions = null optionalposition: 1
LoadAsync 2 overloads
public static async Task<OdgDocument> LoadAsync(String path, OdfLoadOptions options = null, CancellationToken cancellationToken = default) #
Returns: Task<OdgDocument>

Asynchronously loads an ODG package from a path.

Parameters

path System.String requiredposition: 0
options OfficeIMO.OpenDocument.OdfLoadOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public static async Task<OdgDocument> LoadAsync(Stream stream, OdfLoadOptions options = null, CancellationToken cancellationToken = default) #
Returns: Task<OdgDocument>

Asynchronously loads an ODG package from a caller-owned stream.

Parameters

stream System.IO.Stream requiredposition: 0
options OfficeIMO.OpenDocument.OdfLoadOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
LoadFlatXml 2 overloads
public static OdgDocument LoadFlatXml(String path, OdfLoadOptions options = null) #
Returns: OdgDocument

Loads a flat OpenDocument drawing (FODG).

Parameters

path System.String requiredposition: 0
options OfficeIMO.OpenDocument.OdfLoadOptions = null optionalposition: 1
public static OdgDocument LoadFlatXml(Stream stream, OdfLoadOptions options = null) #
Returns: OdgDocument

Loads FODG from a caller-owned stream.

Parameters

stream System.IO.Stream requiredposition: 0
options OfficeIMO.OpenDocument.OdfLoadOptions = null optionalposition: 1
public Void MovePage(Int32 sourceIndex, Int32 destinationIndex) #
Returns: Void

Moves a page to a zero-based position.

Parameters

sourceIndex System.Int32 requiredposition: 0
destinationIndex System.Int32 requiredposition: 1
public Void RemovePage(Int32 index) #
Returns: Void

Removes a page at a zero-based position.

Parameters

index System.Int32 requiredposition: 0
ToDrawings 3 overloads
public OdfConversionResult<IReadOnlyList<OfficeDrawing>> ToDrawings(OdfConversionLossPolicy lossPolicy = ReportOnly, Boolean forPrint = false, Int32 maximumPages = 1000, CancellationToken cancellationToken = default) #
Returns: OdfConversionResult<IReadOnlyList<OfficeDrawing>>

Projects every Draw page in document order with page-qualified feature losses.

Parameters

lossPolicy OfficeIMO.OpenDocument.OdfConversionLossPolicy = ReportOnly optionalposition: 0
Treatment of unsupported content and approximations.
forPrint System.Boolean = false optionalposition: 1
Selects print-visible layers instead of screen-visible layers.
maximumPages System.Int32 = 1000 optionalposition: 2
Maximum source page count accepted before projecting any page.
cancellationToken System.Threading.CancellationToken = default optionalposition: 3
Cooperative cancellation between pages and shapes.
public OdfConversionResult<IReadOnlyList<OfficeDrawing>> ToDrawings(OdfConversionLossPolicy lossPolicy, Boolean forPrint, Int32 maximumPages, CancellationToken cancellationToken, OdfDateTimeFieldProjectionOptions dateTimeFields) #
Returns: OdfConversionResult<IReadOnlyList<OfficeDrawing>>

Projects all pages using one explicit date/time field settings snapshot.

Parameters

lossPolicy OfficeIMO.OpenDocument.OdfConversionLossPolicy requiredposition: 0
forPrint System.Boolean requiredposition: 1
maximumPages System.Int32 requiredposition: 2
cancellationToken System.Threading.CancellationToken requiredposition: 3
dateTimeFields OfficeIMO.OpenDocument.OdfDateTimeFieldProjectionOptions requiredposition: 4
public OdfConversionResult<IReadOnlyList<OfficeDrawing>> ToDrawings(OfficeRenderingProfile renderingProfile, OdfConversionLossPolicy lossPolicy = ReportOnly, Boolean forPrint = false, Int32 maximumPages = 1000, CancellationToken cancellationToken = default, OdfDateTimeFieldProjectionOptions dateTimeFields = null) #
Returns: OdfConversionResult<IReadOnlyList<OfficeDrawing>>

Projects pages using caller-supplied fonts and shaping for both layout decisions and the returned drawings.

Parameters

renderingProfile OfficeIMO.Drawing.OfficeRenderingProfile requiredposition: 0
lossPolicy OfficeIMO.OpenDocument.OdfConversionLossPolicy = ReportOnly optionalposition: 1
forPrint System.Boolean = false optionalposition: 2
maximumPages System.Int32 = 1000 optionalposition: 3
cancellationToken System.Threading.CancellationToken = default optionalposition: 4
dateTimeFields OfficeIMO.OpenDocument.OdfDateTimeFieldProjectionOptions = null optionalposition: 5

Properties

public OdgLayers Layers { get; } #

Document-wide layers, inherited by pages without their own or master layer set.

public IReadOnlyList<OdgPage> Pages { get; } #

Drawing pages in document order.