Compartilhar via


MappedName Class

Predefined Merge Field Name.When the object is serialized out as xml, its qualified name is w:mappedName.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Wordprocessing.StringType
        DocumentFormat.OpenXml.Wordprocessing.MappedName

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

Syntax

'Declaration
Public Class MappedName _
    Inherits StringType
'Usage
Dim instance As MappedName
public class MappedName : StringType

Remarks

[ISO/IEC 29500-1 1st Edition]

17.14.23 mappedName (Predefined Merge Field Name)

This element specifies the predefined WordprocessingML MERGEFIELD field name which shall be mapped to the column number specified by the column element (§17.14.6) within this field mapping. [Guidance: This element allows the current column from the specified data source to be mapped to a predefined field name, allowing applications to have one standard set of field names to use regardless of the data source column names, for example, to create the address formats to place into an ADDRESSBLOCK field. end guidance]

If this element is omitted, then the current data source column mapping shall not have a predefined merge field name mapped to its contents, and shall only be referenced via the data source column name specified by the name element (§17.14.24) when referenced by one or more MERGEFIELD fields. If the application does not have a predefined merge field whose name matches the name specified using the val attribute, then this element can be ignored.

[Example: Consider the following WordprocessingML fragment, representing two columns from an external data source which have been mapped to the built-in fields First Name and Last Name, respectively:

<w:fieldMapData>
  <w:column w:val="0" />
  <w:name w:val="Column Name A" />
  <w:mappedName w:val="First Name" />
  …
</w:fieldMapData>
<w:fieldMapData>
  <w:column w:val="1" />
  <w:name w:val="Column Name B" />
  <w:mappedName w:val="Last Name" />
  …
</w:fieldMapData>

The first and second columns, specified by the column element values of 0 and 1 respectively, specify that the predefined WordprocessingML field names First Name and Last Name are mapped to the columns of the external data source, and the data source names for those columns are Column Name A and Column Name B, respectively.

Therefore, if MERGEFIELD fields calling for First Name and Last Name are inserted in a WordprocessingML document connected to the external data source with the field mappings specified above, when the mail merge takes place, the data from the first and second column populates the fields calling for First Name and Last Name data within the merged WordprocessingML document. end example]

Parent Elements

fieldMapData (§17.14.15)

Attributes

Description

val (String Value)

Specifies that its contents contain a string.

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

[Example: Consider the following WordprocessingML fragment:

<w:pPr>
  <w:pStyle w:val="heading1" /> 
</w:pPr>

The value of the val attribute is the ID of the associated paragraph style's styleId.

However, consider the following fragment:

<w:sdtPr>
  <w:alias w:val="SDT Title Example" />
  …
</w:sdtPr>

In this case, the decimal number in the val attribute is the caption of the parent structured document tag. In each case, the value is interpreted in the context of the parent element. end example]

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

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

MappedName Members

DocumentFormat.OpenXml.Wordprocessing Namespace