Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

OdgDocument

OfficeIMO.OpenDocument

Namespace
OfficeIMO.OpenDocument
Assembly
OfficeIMO.OpenDocument
Source revision
1f76172c94d1 with working tree changes
Implements
IDisposable
Modifiers
sealed

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

Inheritance

Usage

Explore 13 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

Accepted by parameters 9

Methods

public OdgPage AddPage(string? name = null, OdfLength? width = null, OdfLength? height = null) #

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

Parameters

name string? = null optional
width OfficeIMO.OpenDocument.OdfLength? = null optional
height OfficeIMO.OpenDocument.OdfLength? = null optional

Returns

OdgPage
public string CloneMasterPage(string sourceName, string? name = null) #

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 string required
Existing, unambiguous master name.
name string? = null optional
Unique destination name; null generates a name from the source master.

Returns

string

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(int sourceIndex, string? name = null) #

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 int required
Zero-based source page position.
name string? = null optional
Unique destination name; null generates a name from the source page.

Returns

OdgPage

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() #

Creates an empty ODF 1.4 drawing.

public OdgPage ImportPage(OdgDocument source, int sourceIndex, string? name = null) #

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 required
A different drawing, loaded from ODG or FODG.
sourceIndex int required
Zero-based source page position.
name string? = null optional
Unique destination name; null generates a name from the source page.

Returns

OdgPage

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) #

Loads an ODG package from a path.

Parameters

path string required
options OfficeIMO.OpenDocument.OdfLoadOptions? = null optional
public static OdgDocument Load(Stream stream, OdfLoadOptions? options = null) #

Loads an ODG package from a caller-owned stream.

Parameters

stream System.IO.Stream required
options OfficeIMO.OpenDocument.OdfLoadOptions? = null optional
LoadAsync 2 overloads
public static async Task<OdgDocument> LoadAsync(string path, OdfLoadOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously loads an ODG package from a path.

Parameters

path string required
options OfficeIMO.OpenDocument.OdfLoadOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<OdgDocument>
public static async Task<OdgDocument> LoadAsync(Stream stream, OdfLoadOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously loads an ODG 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<OdgDocument>
LoadFlatXml 2 overloads
public static OdgDocument LoadFlatXml(string path, OdfLoadOptions? options = null) #

Loads a flat OpenDocument drawing (FODG).

Parameters

path string required
options OfficeIMO.OpenDocument.OdfLoadOptions? = null optional
public static OdgDocument LoadFlatXml(Stream stream, OdfLoadOptions? options = null) #

Loads FODG from a caller-owned stream.

Parameters

stream System.IO.Stream required
options OfficeIMO.OpenDocument.OdfLoadOptions? = null optional
public void MovePage(int sourceIndex, int destinationIndex) #

Moves a page to a zero-based position.

Parameters

sourceIndex int required
destinationIndex int required
public void RemovePage(int index) #

Removes a page at a zero-based position.

Parameters

index int required
ToDrawings 3 overloads
public OdfConversionResult<IReadOnlyList<OfficeDrawing>> ToDrawings(OdfConversionLossPolicy lossPolicy = ReportOnly, bool forPrint = false, int maximumPages = 1000, CancellationToken cancellationToken = default) #

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

Parameters

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

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

Parameters

lossPolicy OfficeIMO.OpenDocument.OdfConversionLossPolicy required
forPrint bool required
maximumPages int required
cancellationToken System.Threading.CancellationToken required
dateTimeFields OfficeIMO.OpenDocument.OdfDateTimeFieldProjectionOptions? required
public OdfConversionResult<IReadOnlyList<OfficeDrawing>> ToDrawings(OfficeRenderingProfile renderingProfile, OdfConversionLossPolicy lossPolicy = ReportOnly, bool forPrint = false, int maximumPages = 1000, CancellationToken cancellationToken = default, OdfDateTimeFieldProjectionOptions? dateTimeFields = null) #

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

Parameters

renderingProfile OfficeIMO.Drawing.OfficeRenderingProfile required
lossPolicy OfficeIMO.OpenDocument.OdfConversionLossPolicy = ReportOnly optional
forPrint bool = false optional
maximumPages int = 1000 optional
cancellationToken System.Threading.CancellationToken = default optional
dateTimeFields OfficeIMO.OpenDocument.OdfDateTimeFieldProjectionOptions? = null optional

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.

public IReadOnlyList<OdgMasterPage> MasterPages { get; } #

All existing drawing masters, including masters not referenced by a page. Reading does not create a master container.

Extension Methods

public static OfficeConversionReport SaveAsImages(OdgDocument document, string folderPath, OfficeImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Saves selected pages with atomic files, bounded output and fidelity acceptance.

Parameters

document OfficeIMO.OpenDocument.OdgDocument required
folderPath string required
options OfficeIMO.Drawing.OfficeImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

OfficeConversionReport
public static async Task<OfficeConversionReport> SaveAsImagesAsync(OdgDocument document, string folderPath, OfficeImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Saves selected pages asynchronously without retaining completed image payloads.

Parameters

document OfficeIMO.OpenDocument.OdgDocument required
folderPath string required
options OfficeIMO.Drawing.OfficeImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<OfficeConversionReport>
ToImages 2 overloads
public static IReadOnlyList<OfficeImageExportResult> ToImages(OdgDocument document, OfficeImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Renders selected source pages in caller order, retaining source and encoding diagnostics.

Parameters

document OfficeIMO.OpenDocument.OdgDocument required
options OfficeIMO.Drawing.OfficeImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

IReadOnlyList<OfficeImageExportResult>
public static void ToImages(OdgDocument document, OfficeImageExportConsumer consumer, OfficeImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Streams selected images without retaining earlier encoded payloads.

Parameters

document OfficeIMO.OpenDocument.OdgDocument required
consumer OfficeIMO.Drawing.OfficeImageExportConsumer required
options OfficeIMO.Drawing.OfficeImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public static Task<IReadOnlyList<OfficeImageExportResult>> ToImagesAsync(OdgDocument document, OfficeImageExportOptions? options = null, CancellationToken cancellationToken = default) #

Renders selected source pages asynchronously with shared cancellation and deadlines.

Parameters

document OfficeIMO.OpenDocument.OdgDocument required
options OfficeIMO.Drawing.OfficeImageExportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<IReadOnlyList<OfficeImageExportResult>>