Table of Contents

Class WordDocument

Namespace
DocWright.Dom
Assembly
DocWright.Dom.dll

The root of the mutable DocWright document model: sections of block content plus the style, numbering, theme and settings definitions and everything preserved for round-trip. Disposal releases the source package; image bytes and preserved parts are streamed lazily, so dispose the document only when they are no longer needed.

public sealed class WordDocument : DomNode, IDocWrightDocument, IDisposable
Inheritance
WordDocument
Implements
Inherited Members
Extension Methods

Constructors

WordDocument()

Initializes an empty document.

Properties

Background

Gets or sets the page background fill (w:document/w:background), or null when the document states none. It is only painted when DisplayBackgroundShape is also on.

Children

Gets this node's children in document order. Nodes without children return an empty list. The list is a live view; mutate through the typed collections (for example Inlines), not through this property.

Endnotes

Gets the endnotes, including the separator pseudo-notes.

Footnotes

Gets the footnotes, including the separator pseudo-notes.

HeaderFooters

Gets the header and footer parts owned by the document and referenced by sections.

Numbering

Gets or sets the numbering definitions. Never null.

PartData

Gets or sets the source-package data source used for lazy image bytes and preserved parts, or null for documents created in memory.

Preservation

Gets the round-trip preservation state (opaque parts and skip counts).

Sections

Gets the sections in document order. Every document has at least one section once content exists.

Settings

Gets or sets the document settings. Never null.

SourceFormatName

Gets the name of the format the document was read from, or null if it was created in memory.

Styles

Gets or sets the style definitions. Never null.

Theme

Gets or sets the document theme. Never null.

Methods

Accept(DomVisitor)

Dispatches to the visitor method for this node's concrete type.

Clone()

Creates a detached deep copy of the whole document, remapping the sections' header/footer references onto the cloned parts. The copy shares the original's PartData package source, so lazy image bytes keep working until the original is disposed.

CloneCore()

Creates the deep copy for Clone(). Implementations copy all owned state, deep-clone children and copy unknown-XML islands.

Dispose()

Releases the source package. Image bytes and preserved parts can no longer be streamed afterwards; the document tree itself stays usable.

FindNote(NoteKind, long)

Finds a footnote or endnote by id.

RemoveChildCore(DomNode)

Removes child from this node's child collections.