Partager via


DocDefaults Class

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

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Wordprocessing.DocDefaults

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

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(ParagraphPropertiesDefault))> _
<ChildElementInfoAttribute(GetType(RunPropertiesDefault))> _
Public Class DocDefaults _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As DocDefaults
[ChildElementInfoAttribute(typeof(ParagraphPropertiesDefault))]
[ChildElementInfoAttribute(typeof(RunPropertiesDefault))]
public class DocDefaults : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • RunPropertiesDefault <w:rPrDefault>

  • ParagraphPropertiesDefault <w:pPrDefault>

[ISO/IEC 29500-1 1st Edition]

17.7.3.1 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.

Thread Safety

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

See Also

Reference

DocDefaults Members

DocumentFormat.OpenXml.Wordprocessing Namespace