Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

MailMerge class

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

Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)
[ChildElementInfoAttribute(typeof(ConnectString))]
[ChildElementInfoAttribute(typeof(AddressFieldName))]
[ChildElementInfoAttribute(typeof(MailSubject))]
[ChildElementInfoAttribute(typeof(MainDocumentType))]
[ChildElementInfoAttribute(typeof(LinkToQuery))]
[ChildElementInfoAttribute(typeof(DataType))]
[ChildElementInfoAttribute(typeof(Query))]
[ChildElementInfoAttribute(typeof(DataSourceReference))]
[ChildElementInfoAttribute(typeof(HeaderSource))]
[ChildElementInfoAttribute(typeof(DoNotSuppressBlankLines))]
[ChildElementInfoAttribute(typeof(Destination))]
[ChildElementInfoAttribute(typeof(MailAsAttachment))]
[ChildElementInfoAttribute(typeof(ViewMergedData))]
[ChildElementInfoAttribute(typeof(ActiveRecord))]
[ChildElementInfoAttribute(typeof(CheckErrors))]
[ChildElementInfoAttribute(typeof(DataSourceObject))]
public class MailMerge : OpenXmlCompositeElement

[ISO/IEC 29500-1 1st Edition]

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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.