Namespace DocWright.Dom
Namespaces
Classes
- AbstractNumbering
An abstract numbering definition (ECMA-376 Part 1 §17.9.1 w:abstractNum): up to nine level definitions shared by concrete numbering instances.
- Block
The base class of block-level content: paragraphs, tables and block-level structured document tags.
- BookmarkEnd
A bookmark end marker (w:bookmarkEnd) matching the BookmarkStart with the same id.
- BookmarkStart
A bookmark start marker (w:bookmarkStart, ECMA-376 Part 1 §17.13.6.2).
- BorderEdge
One border edge (ECMA-376 Part 1 §17.3.4 CT_Border). The border style is kept as the raw ST_Border token (§17.18.2) so art borders and future styles round-trip verbatim.
- BreakChar
An explicit break character (w:br or w:cr, ECMA-376 Part 1 §17.3.3.1).
- CellBorders
The border set of a table cell (ECMA-376 Part 1 §17.4.66 w:tcBorders), including the diagonal borders.
- CellFormat
Sparse table-cell formatting (ECMA-376 Part 1 §17.4.70 w:tcPr).
- CharacterFormat
Sparse run-level formatting (ECMA-376 Part 1 §17.3.2 w:rPr). Every property is nullable: null means "not specified here" and the value comes from the style chain. The DOM never flattens formatting at parse time — editing and re-saving depend on the distinction between explicit and inherited values.
- CharacterFormatChange
A formatting-change annotation on a run (ECMA-376 Part 1 §17.13.5.32 w:rPrChange): the author and date of the change, plus the formatting the run carried before it.
The bag this annotation hangs on holds the current formatting, exactly as RevisionMark hangs on content that is current. Accepting the change drops the annotation and keeps the current formatting; rejecting it restores Previous.
- ChartAxis
One axis of a chart.
- ChartPlot
One plot within a chart: a group of series sharing a type and a pair of axes.
- ChartRef
A chart drawing in the document body (a
w:drawingwhose graphic data is a chart reference).
- ChartSeries
One data series, carrying the values Word cached in the document rather than a live reference to a workbook.
- ChartSpace
A parsed
c:chartSpace, reduced to what is needed to draw the chart from its cached values.
- ChartTextStyle
The text properties a chart element states for itself (
c:txPr, or thea:defRProf a rich title): size, weight, colour and Latin face.
- ColorSchemeMapping
The mapping from WordprocessingML theme color names to theme scheme slots (ECMA-376 Part 1 §17.15.1.20 w:clrSchemeMapping). Defaults match Word's standard mapping (bg1→light1, t1→dark1, bg2→light2, t2→dark2).
- ColumnsFormat
The column layout of a section (ECMA-376 Part 1 §17.6.4 w:cols).
- CompatSetting
One w:compatSetting entry (ECMA-376 Part 1 §17.15.3.4), preserved verbatim.
- DocDefaults
The document-wide formatting defaults (ECMA-376 Part 1 §17.7.5.1 w:docDefaults) — the base of every resolution chain.
- DocumentPreservation
Everything preserved from the source package that is not represented in the document tree: opaque parts, the package's relationship table, and the counts of known-transient markup that was deliberately not modeled (proofing marks, cached page-break hints). Together with the unknown-XML islands on nodes, this guarantees zero silent drops.
- DocumentProtection
A document's protection settings (
w:documentProtection) and write-protection recommendation (w:writeProtection), as recorded in the settings part.Modelled, not enforced. DocWright reports what a document asks for and round-trips it unchanged; it does not stop anything. Every editing API in the library will happily modify a document whose Edit is ReadOnly, and rendering ignores these settings entirely. Word applies them as a user-interface convenience, not as a security boundary, and neither does anything else — treat them as a statement of intent.
Password material is preserved, never verified. The hash, salt and algorithm are read and written back byte for byte so a protected document survives a round trip, but nothing in this phase computes or checks them.
- DocumentSettings
Document-level settings that affect layout and text handling (the settings part, ECMA-376 Part 1 §17.15.1). Unknown settings are preserved as unknown-XML islands on this object.
- DocumentTheme
The document theme (the theme part): font scheme, color scheme and format scheme. When the document has no theme part, Word's Office defaults apply (Aptos Display / Aptos, the Office 2023 colour set), which CreateOfficeDefault() reproduces.
- DomNode
The base class of every node in the mutable DocWright document tree. Nodes know their Parent, expose their Children for generic traversal, support deep Clone() and double-dispatch via Accept(DomVisitor) (virtual dispatch, no reflection). These are the primitives that find/replace, compare, merge/split and mail merge build on.
- DomNodeList<T>
An ordered collection of child nodes that maintains parent links: adding a node sets its Parent, removing clears it. A node can belong to at most one parent at a time; move a node by removing it (or cloning it) first.
- DomTextExtensions
Text-extraction helpers for any subtree of the document model.
- DomVisitor
Double-dispatch visitor over the document tree. Every method has a default implementation that visits the node's children, so a subclass overrides only the node types it cares about and still traverses the whole tree. Dispatch is virtual — no reflection — and new node types are added as new virtual methods, which keeps the type evolution additive.
- FieldChar
A field state character. Fields are preserved as begin/code/separator/result/end chains with their cached result text in the DOM; evaluation is a later phase. Simple fields (w:fldSimple) are normalized to an equivalent chain with FromSimpleField set on the begin character.
- FieldCode
A fragment of field instruction text (w:instrText or w:delInstrText), located between a field's begin and separate characters. Excluded from GetText(DomNode, RevisionView).
- GeometryShape
A shape with an outline, paint and optional text body (wps:wsp or a VML shape element).
- HeaderFooter
A header or footer part's content (w:hdr / w:ftr). Owned by HeaderFooters and referenced by sections; one part can be shared by several sections, matching the package structure.
- HyperlinkEnd
The end marker of a hyperlink opened by the matching HyperlinkStart.
- HyperlinkStart
The start marker of a hyperlink (w:hyperlink, ECMA-376 Part 1 §17.16.22). The link's content sits between the start and the matching HyperlinkEnd so runs keep their own formatting and revision marks.
- ImageAnchor
Positioning and wrapping data of an anchored (floating) image (ECMA-376 Part 1 §20.4.2.3 wp:anchor). Raw relative-from and alignment tokens are kept verbatim; offsets are EMU as written.
- ImageRef
A reference to a picture in the document (w:drawing containing a pic:pic). Image bytes are not buffered into the DOM: OpenStream() streams them from the source package part on demand, so the owning WordDocument must not be disposed first. The complete w:drawing XML is preserved as an unknown-XML island on this node so effects, wrap polygons and future markup round-trip losslessly.
- Inline
The base class of every inline (paragraph content) node.
- Note
A footnote or endnote body (w:footnote / w:endnote). Referenced from body content by NoteRef via Id.
- NoteProperties
Footnote or endnote placement and numbering options recorded on a section (ECMA-376 Part 1 §17.11.11 w:footnotePr / §17.11.5 w:endnotePr). Raw tokens are kept verbatim; numbering evaluation is a later phase.
- NoteRef
A footnote or endnote reference mark (w:footnoteReference / w:endnoteReference), or — when IsSelfReference is set — the mark inside the note's own body (w:footnoteRef / w:endnoteRef).
- NumberingCollection
The document's numbering definitions (the numbering part): abstract definitions plus concrete instances, with lookups by id.
- NumberingInstance
A concrete numbering instance (ECMA-376 Part 1 §17.9.15 w:num) mapping a numbering id used by paragraphs to an abstract definition plus optional level overrides.
- NumberingLevel
One level definition of an abstract numbering (ECMA-376 Part 1 §17.9.6 w:lvl). The number format is kept as the raw ST_NumberFormat token (§17.18.59) so all sixty-plus formats round-trip verbatim; counter evaluation is a later phase.
- NumberingLevelOverride
A per-level override inside a numbering instance (ECMA-376 Part 1 §17.9.8 w:lvlOverride): a start override, a full level redefinition, or both.
- OleObject
An embedded or linked OLE object (
w:object/o:OLEObject).
- PackageRelationship
One entry of the source package's relationship table, recorded verbatim on read.
Two things depend on it. Relationships that reach a PreservedPart cannot be rebuilt from the document tree at all — the model does not represent those parts — so without the table a package carrying custom XML or document properties cannot be reassembled. And for parts the model *does* represent, the recorded id lets a writer reuse the source's relationship ids instead of renumbering them, so a read-then-save with no edits does not churn every r:id in the document.
- Paragraph
A paragraph (w:p): a sequence of inlines plus sparse paragraph formatting and the formatting of the paragraph mark itself.
- ParagraphBorders
The border set of a paragraph (ECMA-376 Part 1 §17.3.1.24 w:pBdr).
- ParagraphFormat
Sparse paragraph-level formatting (ECMA-376 Part 1 §17.3.1 w:pPr). Every property is nullable — null means "not specified here"; effective values come from the style chain via the style resolver. All lengths are twips except LineSpacing, whose unit depends on LineSpacingRule.
- ParagraphFormatChange
A formatting-change annotation on a paragraph (ECMA-376 Part 1 §17.13.5.29 w:pPrChange): the author and date of the change, plus the paragraph formatting that preceded it.
Previous is a CT_PPrBase bag, so it never carries the paragraph mark's run properties or a section's properties — those are not part of what a paragraph formatting change records.
- PreservationInventory
Produces a deterministic, culture-independent inventory of everything a document preserves outside the modeled tree: unknown-XML islands (from nodes, format bags and definitions), opaque parts, and counted known-transient skips. Two parses of the same file yield byte-identical inventories, which the preservation tests assert.
- PreservedPart
An unknown package part preserved opaquely for lossless round-trip (customXml, glossary, VBA and so on). Bytes are streamed lazily from the source package via the owning document's PartData.
- RevisionMark
A tracked-change annotation (ECMA-376 Part 1 §17.13.5.18 w:ins / §17.13.5.14 w:del). The DOM keeps both inserted and deleted content; the style resolver collapses them according to the requested RevisionView.
- RowFormat
Sparse table-row formatting (ECMA-376 Part 1 §17.4.81 w:trPr).
- RunContentInline
The base class of inlines that live inside a w:r and therefore carry run formatting: text, breaks, field characters, images and note references.
- SdtBlock
A block-level structured document tag (content control). The content is surfaced in Blocks so rendering and text extraction treat it transparently; the wrapper and its properties are kept for round-trip.
- SdtInline
An inline-level structured document tag (content control). The content is surfaced in Inlines so rendering and text extraction treat it transparently; the wrapper and its properties are kept for round-trip.
- SdtProperties
Properties of a structured document tag (ECMA-376 Part 1 §17.5.2.38 w:sdtPr). The commonly-consumed fields are surfaced; the complete w:sdtPr XML is preserved verbatim in RawXml so every control type round-trips losslessly.
- Section
A section (w:sectPr scope): a run of block content plus page geometry and references to the headers and footers that apply. Header/footer parts are owned by HeaderFooters and can be shared by multiple sections, so the section holds references, not children. A section without a reference of a given use inherits the previous section's header/footer at resolve time (§17.10.5).
- SectionFormat
Sparse section-level formatting (ECMA-376 Part 1 §17.6.17 w:sectPr). Sections do not participate in style inheritance; unspecified values fall back to application defaults in the style resolver (US Letter, 1in margins, per Word).
- Shading
Shading applied behind content (ECMA-376 Part 1 §17.3.5 CT_Shd). The pattern is kept as the raw ST_Shd token (§17.18.78) so all pattern values round-trip verbatim.
- ShapeColor
A DrawingML color: a source plus the ordered transforms applied to it. Theme resolution happens in the layout resolver, which owns the document theme and color-scheme mapping.
- ShapeFill
The interior paint of a shape.
- ShapeGeometry
The outline of a shape: either a named preset with its adjust values, or an explicit path list.
- ShapeGradientStop
One gradient stop (a:gs).
- ShapeGroup
A group of shapes (wpg:wgp, wpg:grpSp or v:group). Children are authored in the group's child coordinate space and mapped into the parent's space by the group transform.
- ShapeGuide
One shape guide (a:gd): a name bound to a formula in the DrawingML guide language (ECMA-376 Part 1 §20.1.9.11), for example "*/ w adj 100000".
The formula is kept verbatim rather than evaluated at parse time because guide values depend on the shape's extent, which the reader does not own. Evaluation happens in the layout resolver, where the extent is known.
- ShapeLineEnd
A line-end decoration (a:headEnd / a:tailEnd): an arrowhead or similar drawn at one end of an open outline, scaled by the stroke width.
- ShapeNode
One node of a drawing's shape tree. Deliberately not a DomNode: shape geometry is presentation, not editable document content, so it stays out of the visitor and parent/child machinery. Text inside a shape is document content and lives in TextBody, which the owning ShapeRef surfaces through Children.
- ShapePath
One subpath of a shape outline (a:path). Width/Height are the path's own coordinate space; zero means the commands are already in EMU.
- ShapePathCommand
One command of a shape outline: a verb plus the points it consumes (0 for close, 1 for move/line, 2 for quadratic, 3 for cubic).
- ShapePicture
A picture nested inside a shape tree (pic:pic under wpg:wgp). Bytes stream from the source package exactly as they do for ImageRef.
- ShapeRef
A reference to a drawing whose content is a shape or shape group rather than a plain picture (a w:drawing holding wpg:wgp or wps:wsp, or a w:pict holding VML shapes). Anchoring is shared with ImageRef through ImageAnchor, so shapes float, wrap and stack exactly as pictures do. The complete source XML is preserved as an unknown-XML island so unmodelled markup round-trips losslessly.
- ShapeRelativeRect
A rectangle expressed as insets from each edge of a reference rectangle, in thousandths of a percent (DrawingML
CT_RelativeRect:a:fillToRect,a:tileRect). Positive values inset; negative values extend outside the reference rectangle.
- ShapeShadow
An outer shadow cast by a shape (
a:effectLst/a:outerShdw).
- ShapeStroke
The outline stroke of a shape (a:ln).
- ShapeStyleReference
A shape's theme style references (wps:style). Each index selects an entry of the theme format scheme, with the accompanying color bound to the phClr placeholder.
- ShapeTextBody
The text body of a shape (wps:txbx/w:txbxContent or v:textbox/w:txbxContent). Blocks are live document content owned by the enclosing ShapeRef, so document-wide text extraction and visitor traversal see them.
- ShapeTransform2D
The 2-D placement of a shape or group inside its parent's coordinate space (ECMA-376 Part 1 §20.1.7.6 a:xfrm). For a group, ChildOffsetX and ChildExtentX additionally define the coordinate space its children are authored in.
- ShapeWordArt
WordArt: text that is drawn as shape geometry rather than as a run of text (v:textpath).
- Style
One style definition (ECMA-376 Part 1 §17.7.4.17 w:style), preserving the definition and its links — never flattened.
- StyleCollection
The document's style definitions (the styles part), with ordinal lookup by style id and per-type defaults. Definition order is preserved for round-trip.
- TabChar
An explicit tab character (w:tab, ECMA-376 Part 1 §17.3.3.30).
- Table
A table (w:tbl): a grid definition plus rows of cells.
- TableBorders
The border set of a table (ECMA-376 Part 1 §17.4.38 w:tblBorders).
- TableCell
A table cell (w:tc) containing block-level content, including nested tables.
- TableCellMargins
The default cell margins of a table or the margins of one cell (ECMA-376 Part 1 §17.4.42 w:tblCellMar / §17.4.68 w:tcMar).
- TableFormat
Sparse table-level formatting (ECMA-376 Part 1 §17.4.59 w:tblPr).
- TableLook
Which conditional-formatting regions of a table style are enabled on a table (ECMA-376 Part 1 §17.4.55 w:tblLook). Word writes both the legacy bitmask and the explicit attributes; the explicit values win when present.
- TableRow
A table row (w:tr).
- TableStyleConditional
One conditional-formatting block of a table style (ECMA-376 Part 1 §17.7.6.6 w:tblStylePr).
- TextRun
A run of text with uniform direct formatting (w:r with w:t/w:delText content). Non-breaking and soft hyphens are represented as their Unicode characters (U+2011, U+00AD) within Text. Tabs are not: a w:tab is an element, so it is modelled as a TabChar inline of its own.
- ThemeColorScheme
The theme color scheme (ECMA-376 Part 1 §20.1.6.2 a:clrScheme): twelve concrete colors. System colors (a:sysClr) are resolved to their lastClr at parse time.
- ThemeFontSet
One font set of the theme font scheme (ECMA-376 Part 1 §20.1.4.1.24 a:majorFont / §20.1.4.1.25 a:minorFont): a Latin, East Asian and complex-script typeface plus per-script overrides.
- ThemeFormatScheme
The theme's format scheme (ECMA-376 Part 1 §20.1.4.1.14 a:fmtScheme): the numbered fill and line styles a shape selects with
a:fillRef/a:lnRef.The styles are written against the
phClrplaceholder (Placeholder), which the referencing shape binds to its own colour. That indirection is the whole point: a shape says "fill style 2 in accent6" and the theme decides that fill style 2 is a three-stop tint gradient.
- UnknownBlock
A block-level element DocWright does not model, preserved in place so its position in the block sequence survives round-trip (for example w:altChunk or block-level permission markers).
- UnknownInline
An inline-level element DocWright does not model, preserved in place so its position among the paragraph's inlines survives round-trip (for example comment range markers, legacy VML pictures or embedded OLE objects).
- UnknownXml
An opaque island of source XML preserved for lossless round-trip. Islands attach to the nearest model object that hosted the unparsed markup; nothing encountered during parsing is silently discarded.
- UnknownXmlHost
Base class for every model object that can host preserved UnknownXml islands: DOM nodes, sparse format bags, and definition objects (styles, numbering levels, settings). The island list is allocated lazily so undamaged documents pay nothing for the capability.
- WordDocument
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.
Structs
- ColumnSpec
One explicit column definition inside w:cols (ECMA-376 Part 1 §17.6.3 w:col).
- DocColor
A color value as written in the source: either a literal RGB value (including the special "auto"), or a theme slot reference with optional tint/shade transforms (ECMA-376 Part 1 §17.3.2.6 w:color and equivalents). The style resolver turns this into a concrete ColorRgb; a theme reference takes precedence over the literal value when both are present, matching Word.
- LanguageSettings
The languages of a run per script class (ECMA-376 Part 1 §17.3.2.20 w:lang), as BCP-47 tags kept verbatim.
- ShapeColorTransform
One DrawingML color transform (ECMA-376 Part 1 §20.1.2.3), kept in document order because the transforms do not commute.
- ShapePoint
A point in shape path child space.
- TabStop
A custom tab stop (ECMA-376 Part 1 §17.3.1.37 CT_TabStop).
- TableWidth
A table measurement: a value plus its unit (ECMA-376 Part 1 §17.4.87 CT_TblWidth). For Twips the value is twips; for Percent it is fiftieths of a percent (5000 = 100%).
Interfaces
- IPackagePartDataSource
Opens streams over parts of the source package on demand. Implemented by format readers so image bytes and preserved unknown parts are streamed lazily instead of being buffered into the document model.
Enums
- ChartAxisKind
Which of a chart's two axes an axis definition is.
- ChartCrossBetween
Where a category sits relative to the value axis's ticks (
c:crossBetween): on the boundary between two ticks, so a bar has a slot of its own, or on the tick itself, so an area's first and last points sit on the plot's edges.
- ChartGrouping
How a plot's series are combined (c:grouping).
- ChartLegendPosition
Where the legend sits (c:legendPos).
- ChartMarkerSymbol
The symbol a line or scatter series draws at each point (
c:marker/c:symbol).
- ChartTickMark
Where an axis draws its tick marks relative to the axis line.
- DocumentEditRestriction
What editing a document's protection settings allow (ECMA-376 Part 1 §17.15.1.29 w:documentProtection/@w:edit).
- FieldCharKind
The state a w:fldChar marks in a complex field chain (ECMA-376 Part 1 §17.16.18, ST_FldCharType).
- HeaderFooterKind
Distinguishes headers from footers.
- HeaderFooterUse
Which page class a header or footer reference applies to (ECMA-376 Part 1 §17.18.36 ST_HdrFtr).
- ImagePlacement
How an image participates in text flow.
- ImageWrapKind
How text wraps around an anchored image (ECMA-376 Part 1 §20.4.2 wrap elements).
- OleObjectKind
How an embedded object relates to its data (
o:OLEObject@Type).
- RevisionKind
The kind of a tracked change captured on document content.
- ShapeColorSource
How a color is sourced before its transforms are applied.
- ShapeFillKind
How a shape interior is painted.
- ShapeGeometryKind
How a shape's outline is described (ECMA-376 Part 1 §20.1.9).
- ShapeGradientKind
How a gradient's stops are swept across the shape: the choice between
a:linanda:pathinsidea:gradFill.
- ShapeGradientPathKind
The outward sweep a path gradient follows (
a:path@path).
- ShapeLineEndKind
The decoration drawn at one end of an open outline (ECMA-376 Part 1 §20.1.10.33 ST_LineEndType).
- ShapeLineEndSize
How large a line-end decoration is, as a multiple of the stroke width (ST_LineEndWidth / ST_LineEndLength).
- ShapePathFill
How one subpath of a shape outline is filled relative to the shape's own fill (ECMA-376 Part 1 §20.1.10.36 ST_PathFillMode). The shaded modes are how flat DrawingML geometry fakes depth — the lit top of a cylinder, the shaded side of a cube.
- ShapePathVerb
One drawing command in a shape outline. Coordinates are in the path's own child space; Width and Height map them onto the shape's EMU extent.
- ShapeTextAnchor
Where text sits vertically inside a shape (a:bodyPr anchor).
- ShapeTextDirection
Which way a shape's text body reads (a:bodyPr vert).
- StyleType
The kind of a style definition (ECMA-376 Part 1 §17.18.83 ST_StyleType).
- TableStyleConditionalType
The conditional-formatting region a w:tblStylePr block targets (ECMA-376 Part 1 §17.18.89 ST_TblStyleOverrideType).
- ThemeColorSlot
A theme color slot referenced by formatting (ECMA-376 Part 1 §17.18.97 ST_ThemeColor). The mapped slots (Background1 through Text2) resolve through the document's clrSchemeMapping to a concrete scheme slot.
- ThemeFontSlot
A theme font slot referenced by rFonts theme attributes (ECMA-376 Part 1 §17.18.96 ST_Theme).
- UnknownXmlKind
The reason a piece of source XML was preserved opaquely instead of being parsed into the document model.