w:docDefaults (Document Defaults)
Specifies the default paragraph and run formatting properties applied to all content that has no explicit style.
Parent elements
Description
w:docDefaults defines the default run and paragraph properties that apply to any text in the document when no style or direct formatting overrides them. It is defined in ECMA-376 Part 1 §17.7.5.1.
It contains two child elements:
w:rPrDefault— wraps aw:rPrwith default run properties (font, size, language, etc.).w:pPrDefault— wraps aw:pPrwith default paragraph properties (line spacing, etc.).
These defaults form the lowest layer of the property-resolution hierarchy, below document styles and above nothing.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
| (none) | — | — | Properties are expressed via w:rPrDefault and w:pPrDefault child elements. |
Examples
<w:docDefaults>
<w:rPrDefault>
<w:rPr>
<w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
<w:sz w:val="20"/>
<w:lang w:val="en-US"/>
</w:rPr>
</w:rPrDefault>
<w:pPrDefault>
<w:pPr>
<w:spacing w:after="160" w:line="259" w:lineRule="auto"/>
</w:pPr>
</w:pPrDefault>
</w:docDefaults>
new DocDefaults(
new RunPropertiesDefault(
new RunPropertiesBaseStyle(
new RunFonts { Ascii = "Calibri", HighAnsi = "Calibri" },
new FontSize { Val = "20" },
new Languages { Val = "en-US" })),
new ParagraphPropertiesDefault(
new ParagraphPropertiesBaseStyle(
new SpacingBetweenLines { After = "160", Line = "259", LineRule = LineSpacingRuleValues.Auto })));