ITP instructions within Microsoft Word fields

The use of ITP instructions within fields allows you to replace any part of a field including the formatting options.

Field basics

A field in Microsoft Word exists of two visible parts:

  1. A field's formatting specification, containing formatting options.
  2. The printable content of the field.

These parts are stored sequentially in the Microsoft Word document separated by invisible markers:

By selecting a field and typing <shift>+F9 the user can switch between the content and the definition of the field.

Fields can be updated manually by using the F9 key or automatically when a document is printed.

Example

An automatically updated date and time field would look on paper like:

23-3-99 14:54:00

whereas the field specification would look like

{ TIME \@ "d-M-yy H:mm:ss" }

The part between the quotes is the formatting part. This could be modified manually to contain ITP instructions.

For example:

{ TIME \@ "@(time_and_date_mask)" }

Updating this field in the model document by pressing the F9 key will result in the following field:

@(ti56e_an23_23ate)

This is the content of the field conforming to the current specification.

Warning

If during model execution ITP replaces the ITP expression in the field with a correct field expression, Microsoft Word will have to update the field before the content is displayed correctly.

Refer to the sample document in the Examples folder of the support section of the Aia website for a documented example how to use fields to set the document properties of a result document.

Activating ITP instructions in fields

By default ITP instructions within fields are ignored and copied directly into the result document.

Add the setting

ITPCOMPATIBLEFIELD=N

to the ITP configuration file to enable ITP instructions within fields.

By default only instructions within the formatting specification are recognized.

Add the setting

ITPEXPANDVISFIELD=Y

to expand ITP instructions in the printable part of the field. Note that this part might be lost if the content of the field is recalculated.

Fields and variables; escaping the quotes

Note that Microsoft Word fields often contain quotes. If you are producing the field between # marks this is not a problem. If you are placing the field into a variable, you will have to manually escape all the quotes within the field, in both the content and the definition.