[Table of Contents] [docx version]

WordprocessingML Reference Material - Table of Contents

docVar (Single Document Variable)

This element specifies the parameters of a single document variable. A document variable is a storage location for arbitrary customer data in name/value pairs that will be persisted in a given WordprocessingML document. Specifically, this element specifies through its name and val attributes the name and value pair for a given document variable.

[Note: This mechanism is maintained for legacy compatibility only, and should be avoided in favor of the custom XML data support defined in this Office Open XML Standard. end note]

[Example: Consider the following WordprocessingML fragment specifying a document variable named example and containing the value example value:

<w:docVars>

<w:docVar w:name="example" w:val="example value" />

</w:docVars>

The docVar element defines a single document variable, named example using the name attribute, and assigned the value example value through the val attribute. end example]

Parent Elements

docVars2.15.1.31)

 

Attributes

Description

name (Document Variable Name)

Specifies the name of the parent document variable.

 

[Example: Consider the following WordprocessingML fragment specifying a document variable:

 

<w:docVars>

<w:docVar w:name="example name" w:val="example value" />

</w:docVars>

 

The name attribute specifies that the name of the document variable is example name. end example]

 

The possible values for this attribute are defined by the ST_String simple type2.18.89).

val (Document Variable Value)

Specifies the value of the parent document variable.

 

[Example: Consider the following WordprocessingML fragment specifying a document variable:

 

<w:docVars>

<w:docVar w:name="example name" w:val="Tristan Davis" />

</w:docVars>

 

The val attribute specifies that the value of the document variable is Tristan Davis. end example]

 

The possible values for this attribute are defined by the ST_String simple type2.18.89).

The following XML Schema fragment defines the contents of this element:

<complexType name="CT_DocVar">

   <attribute name="name" type="ST_String" use="required"/>

   <attribute name="val" type="ST_String" use="required"/>

</complexType>