ActiveRecord class

Office 2013 and later

Record Currently Displayed In Merged Document. When the object is serialized out as xml, its qualified name is w:activeRecord.

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

public class ActiveRecord : DecimalNumberType

[ISO/IEC 29500-1 1st Edition]

activeRecord (Record Currently Displayed In Merged Document)

This element specifies that the hosting application shall display the given record from the specified external data source in place of the MERGEFIELD fields (§17.16.5.35) its data is mapped to via the fieldMapData element (§17.14.15) in a merged document. When this element is present, the val attribute shall specify the one-based index of the record from that data source which shall be used to populate this document.

If the activeRecord element is omitted with the viewMergedData element's val attribute equal to true, the hosting application shall behave as if the activeRecord element's val attribute was equal to 1. If the viewMergedData element (§17.14.36) is omitted or present with a val attribute equal to 0 or false, then this element shall be ignored. If the activeRecord record is given a val attribute that is less than one or greater than the number of records in the specified external data source, the hosting application shall treat this val attribute as if it were equal to 1.

[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="1" />
<w:activeRecord w:val="2" />

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 Ms. Smith:

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

Sincerely,

end example]

[Example: Consider the following WordprocessingML from a merged WordprocessingML document:

<w:viewMergedData />
<w:activeRecord w:val="2" />

The activeRecord element is present and has a val attribute equal to 2, therefore this WordprocessingML specifies that a conforming hosting application must display data from the second record of the specified external data source in place of fields its data is mapped to within the merged document. end example]

Parent Elements

mailMerge (§17.14.20)

Attributes

Description

val (Decimal Number Value)

Specifies that the contents of this attribute contains a decimal number.

The contents of this decimal number are interpreted based on the context of the parent XML element.

[Example: Consider the following numeric WordprocessingML property of simple type ST_DecimalNumber:

<… w:val="1512645511" />

The value of the val attribute is a decimal number whose value must be interpreted in the context of the parent element. end example]

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

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