[Table of Contents] [docx version]

WordprocessingML Reference Material - Table of Contents

Syntax

The general syntax of a field is as follows:

field:
field-type [ instruction ]

field-type:
date-and-time
document-automation
document-information
equations-and-formulas
index-and-tables
links-and-references
mail-merge
numbering
user-information
form-field

date-and-time:
CREATEDATE | DATE | EDITTIME | PRINTDATE | SAVEDATE | TIME

document-automation:
COMPARE | DOCVARIABLE | GOTOBUTTON | IF | MACROBUTTON | PRINT

document-information:
AUTHOR | COMMENTS | DOCPROPERTY | FILENAME | FILESIZE | INFO
| KEYWORDS | LASTSAVEDBY | NUMCHARS | NUMPAGES | NUMWORDS | SUBJECT
| TEMPLATE | TITLE

equations-and-formulas:
= formula | ADVANCE | EQ | SYMBOL

index-and-tables:
INDEX | RD | TA | TC | TOA | TOC | XE

links-and-references:
AUTOTEXT | AUTOTEXTLIST | BIBLIOGRAPHY | CITATION | HYPERLINK | INCLUDEPICTURE | INCLUDETEXT
| LINK | NOTEREF | PAGEREF | QUOTE | REF | STYLEREF

mail-merge:
ADDRESSBLOCK | ASK | COMPARE | DATABASE | FILLIN | GREETINGLINE | IF
| MERGEFIELD | MERGEREC | MERGESEQ | NEXT | NEXTIF | SET | SKIPIF

numbering:
AUTONUM | AUTONUMLGL | AUTONUMOUT | BARCODE | LISTNUM | PAGE | REVNUM
| SECTION | SECTIONPAGES | SEQ

user-information:
USERADDRESS | USERINITIALS | USERNAME

form-field:
FORMCHECKBOX | FORMDROPDOWN | FORMTEXT

instruction:
field
field-argument
switches
field-argument switches
switches field-argument

field-argument:
[ " ] text [ " ]

switches:
switch
switch switches

switch:
formatting-switch
field-specific-switch

formatting-switch:
date-and-time-formatting-switch
numeric-formatting-switch
general-formatting-switch

field-specific-switch:
\field-switch-character [ field-argument ]

field-switch-character:
!
one or two Latin letters

formula is discussed in §2.16.3, and formatting-switches are discussed in §2.16.4.

If the text in a field-argument contains white space, the delimiting double-quote characters shall be present; otherwise, they are optional. To include a double-quote character in text, it shall be preceded with a backslash (\). [Example: The field argument "\"name\"" results in the argument's actually being "name". end example] To include a backslash character in text, it shall be preceded with another backslash (\). [Example: File system pathnames on some systems use a backslash as a directory separator, as in the field

INCLUDETEXT "E:\\ReadMe.txt"

in which case, each such separator needs to be preceded with a backslash, as shown above. end example]

Arbitrary amount of white space can occur before the first token, after the last token, and between successive tokens, including no white space at all.

[Example: Here are examples of some fields:

DATE
DATE \@ "dddd, MMMM dd, yyyy"
DATE \@ "dddd, MMMM dd, yyyy" \h

The field result of all three is today's date: The first field uses some implementation-defined format and the Gregorian calendar; the second field uses the specified format and the Gregorian calendar; and the third field uses the specified format and the Hijri lunar calendar. When rendered in a US-English context on December 31, 2005, the results of these fields were as follows:

12/31/2005
Saturday, December 31, 2005
AsSabt, Thoul Ki'dah 30, 1426

end example]

Except for = formula, the terminals of field-type are alphabetic tokens [Example: Some field-type names are ASK, COMMENTS, NEXT, and SET. end example]. These tokens are called field-type names. Field-type names are case-insensitive. [Example: The field-type names DATE, Date, dAtE, and date are equivalent. end example]

field-switch-characters are case-insensitive. [Example: \b and \B are equivalent. end example]

There is no ordering of switch entries in switches.