MailMerge Class

Mail Merge Settings.When the object is serialized out as xml, its qualified name is w:mailMerge.

Inheritance Hierarchy

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

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

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(DoNotSuppressBlankLines))> _
<ChildElementInfoAttribute(GetType(DataSourceObject))> _
<ChildElementInfoAttribute(GetType(MainDocumentType))> _
<ChildElementInfoAttribute(GetType(LinkToQuery))> _
<ChildElementInfoAttribute(GetType(DataType))> _
<ChildElementInfoAttribute(GetType(ConnectString))> _
<ChildElementInfoAttribute(GetType(Query))> _
<ChildElementInfoAttribute(GetType(DataSourceReference))> _
<ChildElementInfoAttribute(GetType(HeaderSource))> _
<ChildElementInfoAttribute(GetType(Destination))> _
<ChildElementInfoAttribute(GetType(AddressFieldName))> _
<ChildElementInfoAttribute(GetType(MailSubject))> _
<ChildElementInfoAttribute(GetType(MailAsAttachment))> _
<ChildElementInfoAttribute(GetType(ViewMergedData))> _
<ChildElementInfoAttribute(GetType(ActiveRecord))> _
<ChildElementInfoAttribute(GetType(CheckErrors))> _
Public Class MailMerge _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As MailMerge
[ChildElementInfoAttribute(typeof(DoNotSuppressBlankLines))]
[ChildElementInfoAttribute(typeof(DataSourceObject))]
[ChildElementInfoAttribute(typeof(MainDocumentType))]
[ChildElementInfoAttribute(typeof(LinkToQuery))]
[ChildElementInfoAttribute(typeof(DataType))]
[ChildElementInfoAttribute(typeof(ConnectString))]
[ChildElementInfoAttribute(typeof(Query))]
[ChildElementInfoAttribute(typeof(DataSourceReference))]
[ChildElementInfoAttribute(typeof(HeaderSource))]
[ChildElementInfoAttribute(typeof(Destination))]
[ChildElementInfoAttribute(typeof(AddressFieldName))]
[ChildElementInfoAttribute(typeof(MailSubject))]
[ChildElementInfoAttribute(typeof(MailAsAttachment))]
[ChildElementInfoAttribute(typeof(ViewMergedData))]
[ChildElementInfoAttribute(typeof(ActiveRecord))]
[ChildElementInfoAttribute(typeof(CheckErrors))]
public class MailMerge : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • MainDocumentType <w:mainDocumentType>

  • LinkToQuery <w:linkToQuery>

  • DataType <w:dataType>

  • ConnectString <w:connectString>

  • Query <w:query>

  • DataSourceReference <w:dataSource>

  • HeaderSource <w:headerSource>

  • DoNotSuppressBlankLines <w:doNotSuppressBlankLines>

  • Destination <w:destination>

  • AddressFieldName <w:addressFieldName>

  • MailSubject <w:mailSubject>

  • MailAsAttachment <w:mailAsAttachment>

  • ViewMergedData <w:viewMergedData>

  • ActiveRecord <w:activeRecord>

  • CheckErrors <w:checkErrors>

  • DataSourceObject <w:odso>

[ISO/IEC 29500-1 1st Edition]

17.14.20 mailMerge (Mail Merge Settings)

This element specifies all of the mail merge information for a document that has been connected to an external data source as part of a mail merge operation.

The document which contains this mail merge data can be of one of two types:

  • A source document, the document which contains all of the information for the mail merge, and is used in conjunction with an application to connect to an external data source and create one document for each record in that data source.

  • A merged document, a document which contains all of the information for the mail merge as well as a reference to a single specific record which shall be used to populate the values of all of the merge fields in that document.

The information in this element shall contain all data needed to connect to a data source and populate any merge fields in the document with data from that data source.

[Example: Consider the following WordprocessingML fragment for a document which is part of a mail merge:

<w:mailMerge>
…
<w:dataType w:val="spreadsheet" />
<w:query w:val="SELECT * FROM `Sheet1$`" />
<w:dataSource r:id="rId1" />
…
</w:mailMerge>

Here, the dataType (§17.14.10) and dataSource (§17.14.9) elements specify that the given document must be connected to the external data source referenced by the relationship whose id value is equal to rId1. While connected to the external data source, the document together with a hosting application can extract data from the external data source as specified by thequery (§17.14.26) element. end example]

Parent Elements

settings (§17.15.1.78)

Child Elements

Subclause

activeRecord (Record Currently Displayed In Merged Document)

§17.14.2

addressFieldName (Column Containing E-mail Address)

§17.14.3

checkErrors (Mail Merge Error Reporting Setting)

§17.14.4

connectString (Data Source Connection String)

§17.14.8

dataSource (Data Source File Path)

§17.14.9

dataType (Data Source Type)

§17.14.10

destination (Merged Document Destination)

§17.14.11

doNotSuppressBlankLines (Remove Blank Lines from Merged Documents)

§17.14.12

headerSource (Header Definition File Path)

§17.14.16

linkToQuery (Query Contains Link to External Query File)

§17.14.18

mailAsAttachment (Merged Document To E-Mail Attachment)

§17.14.19

mailSubject (Merged E-mail or Fax Subject Line)

§17.14.21

mainDocumentType (Source Document Type)

§17.14.22

odso (Office Data Source Object Settings)

§17.14.25

query (Query For Data Source Records To Merge)

§17.14.26

viewMergedData (View Merged Data Within Document)

§17.14.36

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

MailMerge Members

DocumentFormat.OpenXml.Wordprocessing Namespace