Skip to main content
A newer version of this page is available. .

Field Codes

  • 3 minutes to read

Document fields are used as placeholders for data that might change in a document, as well as for mail merge operations. For more information on fields, see the Fields document.

There are three types of fields - MailMerge, Non-MailMerge and Mixed. MailMerge fields are used in the mail merge process, and get a value only if there is a merge data source bound to the RichEditControl. Otherwise, MailMerge fields are displayed as field placeholders that show the name of a corresponding data column, encompassed in angular brackets as follows:

<<CompanyName>> for the MERGEFIELD coded as { MERGEFIELD CompanyName }

A significant difference between MailMerge and Non-MailMerge fields is in their behavior when the Document.MailMerge (or the IRichEditDocumentServer.MailMerge) method is executed. The resulting document does not contain fields of the MailMerge type. MailMerge fields are evaluated and substituted with the resulting values.

Results for Non-MailMerge fields are displayed when the field is updated.

Mixed field types denote fields that do not require a data source for evaluation, but during mail merge they are substituted with their values. CREATEDATE and INCLUDEPICTURE are examples of such fields.

Syntax

{ FIELDNAME Properties Optional_Switches }

  • FIELDNAME - This is the name of the field.
  • Properties - These are any instructions or variables that are used in a particular field. Not all fields have parameters, and in some fields, parameters are optional.
  • Optional switches - These are any optional settings that are available for a particular field. Not all fields have switches available, other than those that control the formatting of the field results.

For example, the {MERGEFIELD Weather.condition *Upper} field denotes the MERGEFIELD field bound to the Weather.condition data field, which displays the text in all caps.

Supported Fields

Field Name Functionality
AUTHOR Inserts the name of a person or organization who created the document.
COMMENTS Inserts the document notes.
CREATEDATE Inserts the current date and time. After a mail merge the field is replaced with the date and time of the mail merge operation.
DATE Inserts the current date and time.
DOCPROPERTY Inserts the value of the document property specified by the field parameter.
DOCVARIABLE Enables you to programmatically insert complex content when this field is updated.
HYPERLINK Enables you to navigate to another location or to a bookmark.
IF Compares two values and inserts the text according to the results of the comparison.
INCLUDEPICTURE Inserts the specified image.
KEYWORDS Inserts the document keywords or tags.
LASTSAVEDBY Inserts the name of the last person who modified and saved the document.
MERGEFIELD Retrieves a value from the bound data source.
NUMPAGES Inserts the total number of pages.
PAGE Inserts the number of the page containing the field.
PRINTDATE Inserts the date and time that a document was last printed.
REVNUM Inserts the number of document revisions.
SAVEDATE Inserts a date and time a document was last saved.
SEQ Provides sequential numbering in the document.
SUBJECT Inserts the document topic of content.
SYMBOL Inserts a symbol.
TC Defines entries for the table of contents.
TIME Inserts the current time.
TITLE Inserts the document title.
TOC Builds a table of contents.

Formatting Options

The following format switches are supported.