Поделиться через


ViewMergedData Class

View Merged Data Within Document.When the object is serialized out as xml, its qualified name is w:viewMergedData.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Wordprocessing.OnOffType
        DocumentFormat.OpenXml.Wordprocessing.ViewMergedData

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

Syntax

'Declaration
Public Class ViewMergedData _
    Inherits OnOffType
'Usage
Dim instance As ViewMergedData
public class ViewMergedData : OnOffType

Remarks

[ISO/IEC 29500-1 1st Edition]

17.14.36 viewMergedData (View Merged Data Within Document)

This element specifies that a specific merged document shall display the data from the specified external data source where merge fields have been inserted. The activeRecord element (§17.14.2) is used to specify which record within the external data source is to have its applicable data displayed where applicable within the WordprocessingML merged document.

If the activeRecord element is not present in the WordprocessingML for the document with the viewMergedData's val attribute equal to true, the hosting application can behave as if the acitveRecord element's val attribute was equal to 1. This element is ignored if the viewMergedData (§17.14.36) element is not present or present with a val attribute equal to Off, 0, or false.

[Example: Consider a merged WordprocessingML document containing two WordprocessingML fields calling for Courtesy Title and Last Name data and a sample text paragraph. Also, note that the external data source this merged document is connected to contains two records, both containing name and address information, with the first record pertaining to Mr. Doe, and the second pertaining to Ms. Smith.

This table below illustrates the necessary WordprocessingML to display applicable data from the specified external data source within the merged document where fields have been inserted:

<w:viewMergedData val="0"/>
<w:viewMergedData val="1" />
<w:activeRecord w:val="1" />
<w:viewMergedData val="0" />
<w:activeRecord w:val="1" />

Dear {MERGEFIELD "Courtesy Title" \m} {MERGEFIELD "Last Name" \m},

Sample letter text. Sample letter text. Sample letter text. Sample letter text. Sample letter text. Sample letter text. Sample letter text.

Sincerely,

Dear Mr. Doe:

Sample letter text. Sample letter text. Sample letter text. Sample letter text. Sample letter text. Sample letter text. Sample letter text.

Sincerely,

Dear {MERGEFIELD "Courtesy Title" \m} {MERGEFIELD "Last Name" \m},

Sample letter text. Sample letter text. Sample letter text. Sample letter text. Sample letter text. Sample letter text. Sample letter text.

Sincerely,

The viewMergedData element specifies that the specified record in the external data source must be displayed in place of merge fields in the current document. end example]

Parent Elements

mailMerge (§17.14.20)

This element’s content model is defined by the common boolean property definition in §17.17.4.

© 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

ViewMergedData Members

DocumentFormat.OpenXml.Wordprocessing Namespace