Table of Contents

Class DocumentSettings

Namespace
DocWright.Dom
Assembly
DocWright.Dom.dll

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.

public sealed class DocumentSettings : UnknownXmlHost
Inheritance
DocumentSettings
Inherited Members

Constructors

DocumentSettings()

Properties

AutoHyphenation

Gets or sets automatic hyphenation (w:autoHyphenation), or null.

BalanceSingleByteDoubleByteWidth

Gets or sets whether w:compat/w:balanceSingleByteDoubleByteWidth is on. See UseWord97LineBreakRules, without which it has no measured effect.

BordersDoNotSurroundFooter

Gets or sets whether page borders measured from the text leave the footer outside them (w:bordersDoNotSurroundFooter), or null (they surround it).

BordersDoNotSurroundHeader

Gets or sets whether page borders measured from the text leave the header outside them (w:bordersDoNotSurroundHeader), or null (they surround it).

CharacterSpacingControl

Gets or sets the value of w:characterSpacingControl as the file states it: doNotCompress, compressPunctuation or compressPunctuationAndJapaneseKana, or null where it says nothing, which means the first. Under the East Asian theme font rule (WQ-0085) either of the compressing values is what lets a line shrink its spaces to fit.

ClrSchemeMapping

Gets or sets the theme-color-name mapping (w:clrSchemeMapping). Never null.

CompatSettings

Gets every w:compatSetting entry verbatim, in document order.

CompatibilityMode

Gets or sets the OOXML compatibility mode from w:compat/w:compatSetting[name="compatibilityMode"], or null when the document does not state one. The resolver treats null as mode 15 and reports DXP1001 for explicit legacy modes (12/14), which are rendered with mode-15 behavior.

ConsecutiveHyphenLimit

Gets or sets the maximum consecutive hyphenated lines (w:consecutiveHyphenLimit), or null.

DecimalSymbol

Gets or sets the decimal separator used by decimal tabs (w:decimalSymbol), or null.

DefaultTabStop

Gets or sets the interval of automatic tab stops (w:defaultTabStop), or null (Word default: 720 twips).

DisplayBackgroundShape

Gets or sets whether the document background is painted (w:displayBackgroundShape), or null. Word stores the background colour on w:document/w:background but only shows it when this flag is on, so both are required before anything is drawn.

DoNotUseHtmlParagraphAutoSpacing

Gets or sets whether w:compat/w:doNotUseHTMLParagraphAutoSpacing is present.

The element's name refers to the autospacing pair (w:beforeAutospacing / w:afterAutospacing), but Word applies it to explicit w:before and w:after too: with the flag clear it collapses a paragraph's space-after against the next paragraph's space-before to the larger of the two, and with it set it adds them. Word's RTF import sets the flag; its HTML import and a plain .docx do not. Measured as WQ-0024.

Null means the document did not state it, which the resolver treats as clear.

EndnoteProperties

Gets or sets the document-wide endnote options (w:settings/w:endnotePr), or null.

Word reads one value from here and nothing else: the position. sectEnd sets each section's endnotes at the end of that section, and docEnd (the default) all of them at the end of the document; a position stated on a section is ignored. The number format, start and restart Word reads from the section (EndnoteProperties), as DocWright does (WQ-0078).

As for FootnoteProperties, preserved markup wins on write.

EvenAndOddHeaders

Gets or sets distinct even/odd headers and footers (w:evenAndOddHeaders), or null.

FootnoteProperties

Gets or sets the document-wide footnote options (w:settings/w:footnotePr), or null.

ECMA-376 calls these the defaults a section's own w:footnotePr overrides. Word does not read them: a footnote position, number format, start or restart stated here alone changes nothing in Word's layout, so DocWright reads them and applies none (WQ-0078). A section's FootnoteProperties is what applies.

A document read from a .docx keeps the element itself as preserved markup, which also holds the references to the separator notes; that markup wins on write. The property is written only for a document that carries no such markup.

HyphenateCaps

Gets or sets whether capitalized words are hyphenated (w:doNotHyphenateCaps inverse), or null.

HyphenationZone

Gets or sets the hyphenation zone width (w:hyphenationZone), or null.

ListSeparator

Gets or sets the list separator (w:listSeparator), or null.

MathProperties

Gets or sets the document's equation settings (m:mathPr, Phase 165), read for layout. The m:mathPr markup is kept as read and written back as read.

MirrorMargins

Gets or sets mirrored margins for facing pages (w:mirrorMargins), or null.

Protection

Gets or sets the document's protection settings (w:documentProtection and w:writeProtection). Never null; a document that recorded neither has a DocumentProtection whose HasDocumentProtection and HasWriteProtection are both false, and nothing is written for it.

These settings are modelled and round-tripped, never enforced. See DocumentProtection.

ThemeFontLanguages

Gets or sets the default text languages (w:themeFontLang), or null.

UseWord97LineBreakRules

Gets or sets whether w:compat/w:useWord97LineBreakRules is on. Stated together with BalanceSingleByteDoubleByteWidth below compatibility mode 15, it stops a document whose defaults name an East Asian theme font from shrinking spaces to fit a line (WQ-0085). Word's RTF import states both.

Methods

Clone()

Creates a deep copy.