MainDocumentType Class

Source Document Type.When the object is serialized out as xml, its qualified name is w:mainDocumentType.

Inheritance Hierarchy


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


Public Class MainDocumentType _
    Inherits OpenXmlLeafElement
Dim instance As MainDocumentType
public class MainDocumentType : OpenXmlLeafElement


[ISO/IEC 29500-1 1st Edition]

17.14.22 mainDocumentType (Source Document Type)

This element specifies the document type of a given WordprocessingML source document.

If this element is omitted, then its value shall be assumed to be formLetters.

[Note: This element is generally used in conjunction with the behavior of an application to customize aspects of the mail merge user interface and experience independent of the WordprocessingML file format. For example, if a given WordprocessingML merged document contains a mainDocumentType element with its val attribute equal to envelopes, the hosting application can surface a piece of user interface specific to creating envelopes when the given document is opened.

In addition, what a hosting application does with the documents that result from importing external data into specified fields can be determined based on the mainDocumentType element, but other than this, is independent of a given merged document's WordprocessingML. For example, if a given merged WordprocessingML document contains a mainDocumentType element with its val attribute equal to email, the hosting application can call a email service after importing external data into specified fields, in order to generate emails containing the resulting documents.

WordprocessingML simply provides the mainDocumentType that can serve as a trigger for an application to surface user interface specific to a document type of mail merge. end note]

[Example: Consider the WordprocessingML below:

<w:mainDocumentType w:val="formLetters" />

In this example, the source document is of the formLetters type, as specified by the mainDocumentType element's val attribute being equal to formLetters. end example]

Parent Elements

mailMerge (§17.14.20)



val (Mail Merge Source Document Type)

Specifies the type of source document which is specified by the given WordprocessingML document.

[Example: Consider the WordprocessingML below:

<w:mainDocumentType w:val="formLetters" />

This WordprocessingML specifies that a given source document is a formLetters document. This setting implies nothing about the file, but can be interpreted by an application as desired. end example]

The possible values for this attribute are defined by the ST_MailMergeDocType simple type (§17.18.54).

[Note: The W3C XML Schema definition of this element’s content model (CT_MailMergeDocType) 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


MainDocumentType Members

DocumentFormat.OpenXml.Wordprocessing Namespace