Export (0) Print
Expand All

DocDefaults class

Document Default Paragraph and Run Properties. When the object is serialized out as xml, its qualified name is w:docDefaults.

Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

[ChildElementInfoAttribute(typeof(RunPropertiesDefault))]
[ChildElementInfoAttribute(typeof(ParagraphPropertiesDefault))]
public class DocDefaults : OpenXmlCompositeElement

[ISO/IEC 29500-1 1st Edition]

docDefaults (Document Default Paragraph and Run Properties)

This element specifies the set of default paragraph and run properties which shall be applied to every paragraph and run in the current WordprocessingML document. These properties are applied first in the style hierarchy; therefore they are superseded by any further conflicting formatting, but apply if no further formatting is present.

If this element is omitted, then the document defaults shall be application-defined by the hosting application.

[Example: Consider the following definition for the document defaults for a WordprocessingML document:

<w:docDefaults>
  <w:pPrDefault>
    <w:pPr>
      <w:jc w:val="center"/>
    </w:pPr>
  </w:pPrDefault>
  <w:rPrDefault>
    <w:rPr>
      <w:b/>
    </w:rPr>
  </w:rPrDefault>
</w:docDefaults>

The child elements of docDefaults specify a default paragraph property of centered text and a default run property of bold text. Applying this formatting to the following fragment from the main document part of the same document:

<w:body>
  <w:p>
    <w:r>
      <w:t>Hello world!</w:t>
    </w:r>
  </w:p>
</w:body>

This paragraph contains no formatting properties, therefore, using the style hierarchy the document default paragraph and run properties are applied as specified within the docDefaults element and the resulting paragraph is centered as specified in the jc element (§17.3.1.13) as well as bold as specified via the b element (§17.3.2.1). end example]

Parent Elements

styles (§17.7.4.18)

Child Elements

Subclause

pPrDefault (Default Paragraph Properties)

§17.7.5.3

rPrDefault (Default Run Properties)

§17.7.5.5

[Note: The W3C XML Schema definition of this element’s content model (CT_DocDefaults) is located in §A.1. end note]

© ISO/IEC29500: 2008.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

Show:
© 2014 Microsoft