pragma

The use of the pragma function allows the Master template to override selected features in the execution process and the creation of result documents.

 pragma ( feature_name;feature_value )

The result of this function is of type TEXT and contains the necessary word processor instructions. These instructions should be put into the result document with the construction @(pragma (...)), unless otherwise specified.

With the exception of the TextBlockTableStyle feature, pragma settings have no effect on the DocXML and HTML output.

The pragma function requires two parameters of type TEXT:

  • feature_name, type TEXT. This is the type of feature to be modified.
  • feature_value, type TEXT. This is the new value of the feature.

The following table describes the currently supported features.

Incorrect use of this function can result in documents that cannot be opened by the word processor. If a feature is not supported by the word processor support, it is silently ignored.

Feature

Value

Effect

Template

path\template name

Replaces the template of the result document with the template given as feature_value. In Microsoft Word DOCX Master Templates, the template must be specified as a valid URL. For example, {path}:\templates\sample.dotm. In Microsoft Word DOC Master Templates, the template must be specified as a file system path.

CurrencyEuro

Y or N

Activates (Y) or deactivates (N) within the Template script the translation of the International Currency Symbol to Unicode euro characters. This functionality is only supported for Microsoft Word Master Templates.

Reset

"textboxchains" or "lists" or "list"

Resets aspects of an Microsoft Word document. Value textboxchains resets the chains of the text boxes in the document. Should be called in the body of the document (not in the header, footer, or text box itself). Value lists resets all numbered lists so they restart numbering the next time they are produced as output. Value list resets only the first numbered list produced as output after the pragma function.

LOCALE:LC_MONETARY:int_curr_symbol

int_curr_symbol

The representation of the multi-character currency code (U).

LOCALE:LC_MONETARY:currency_symbol

currency_symbol

The representation of the single-character currency code ($).

LOCALE:LC_NUMERIC:decimal_point

decimal_point

The representation of the decimal point (.).

LOCALE:LC_NUMERIC:thousands_sep

thousands_sep

The representation of the thousands separator (,).

AutoInsertSeparator

text

Can be used with the keyword TEXTBLOCK (see TEXTBLOCK statement) or with the AUTOINSERT keyword in a FORM. It sets the text generated after each Text Block.

AutoInsertTerminator

text

Can be used with the keyword TEXTBLOCK (see TEXTBLOCK statement) or with the AUTOINSERT keyword in a FORM. It sets the text generated after the last Text Block.

AutoInsertPrefix

prefix

Can be used with automatically inserted Text Block questions in a FORM or in a dynamic FORM (see FORM). It contains the prefix of the set of Text Block styles that needs to be applied to the Text Blocks inserted by the FORM. By default, KCM searches for the Text Block styles with an ITP prefix.

AutoInsertParagraph

paragraph sign

Can be used with automatically inserted Text Block questions in a FORM or in a dynamic FORM (see FORM). It contains the paragraph sign that holds the style applied to the Text Block. It is mainly used when a Text Block needs to be inserted into a table cell. To insert this Text Block into a table cell, the paragraph sign needs to be declared within a table cell itself as well. A corrupted result document could be produced if an incorrect paragraph sign is used.

EnhancedUnicodeSupport

Y, N, or ?

Overrides the setting EnhancedUnicodeSupport in the current environment for all subsequent text-based comparisons that are performed by the Master Template. This pragma can be called more than once to switch behavior within the Master Template. A call to this pragma sets a new value for the setting EnhancedUnicodeSupport and returns the previous value. The output of the pragma function call does not have to be put into the result document.

The value ? can be used to inquire the current value of the setting EnhancedUnicodeSupport without changing it.

EnhancedUnicodeMaps

Y, N, or ?

Overrides the setting EnhancedUnicodeMaps in the current environment. You can use this pragma only before you make the first MAP assignment. Any attempt to change this setting after the first assignment results in a fatal error. A call to this pragma sets a new value for the setting EnhancedUnicodeMaps and returns the previous value. The output of the pragma function call does not have to be put into the result document.

You can use the value ? to inquire the current value of the setting EnhancedUnicodeMaps without changing it.

FacingPages

Y, N, M, or P

Determines how the "different odd or even" setting for the headers and footers is controlled. This option affects the whole document, it cannot be changed in different sections.

The following values are supported:

Y: Enables the setting;

N: Disables the setting;

M: Uses the setting from the Master Template;

P: If the function pagestyle (see pagestyle) is used, enables the setting if any of the template documents has the setting enabled; otherwise, disables the setting. If the function pagestyle is not used, use the setting from the Master Template. The option P is the default behavior.

This functionality is only supported for Microsoft Word Master Templates.

MergeIncludeStyles

Y or N

Determines how styles in documents that are included through the inc function are processed.

The following values are supported:

Y: Replaces styles in the Includes with the styles from the parent document. The layout of the Include might change to match the parent document.

N: Renames styles and document defaults in the Include. The original layout of the include document is maintained as best as possible.

The option Y is the default behavior.

This functionality is only supported for Microsoft Word Master Templates.

OverrideSFP

Y, N, or "" (an empty value)

Overrides the SUPPRESS_FINAL_PARAGRAPH option for the current Text Block.

The following values are supported:

Y: Enables SUPPRESS_FINAL_PARAGRAPH.

N: Disables SUPPRESS_FINAL_PARAGRAPH. "": Disables previous overrides and uses the option as used with the TEXTBLOCK statement.

This function should be called from within a FORMAT function (see FORMAT functions called from within the Text Block. It returns Y if the option was applied correctly; N if the value is unsupported. Other values indicate that the function was not recognized.

TextblockTableStyle

A style name or "" (an empty value)

Overrides the table style used to format the current table in a Text Block. The following values are supported:

table: Uses the default table style (ITP_table). "": Uses the default table style (ITP_table). xxx: Uses a specific table style (ITP_xxx).

The style name is subject to the STYLE_PREFIX and TABLE_STYLE_PREFIX options.

This function should be called from within a FORMAT function called within the table. It returns Y if the option was applied correctly. Any other value indicates that the function was not recognized. This function has no effect in Rich Text Blocks. The resulting table style must exist in the style sheet of the result document.

The style name is used as a class on the table element in the HTML output. The prefix (STYLE_PREFIX and TABLE_STYLE_PREFIX) is omitted from the class name.

The table below lists the functionality that is only available for Microsoft Word DOC Master Templates. Be aware that the DOC type has been deprecated in KCM 5.7.0.

Feature

Value

Effect

UnicodeEuro

Y or N

Activates (Y) or deactivates (N) within the Template script the translation of single-byte euro characters to Unicode euro characters.

FormField: bookmark:Default

Any text

Sets the default content for a Form Field. The formatting of the default text should match the formatting mask.

FormField: bookmark:Format

A formatting mask

Sets the formatting mask for a Form Field.

FormField: bookmark:Help

Any text

Sets the text of a Form Field shown if the end user presses F1.

FormField: bookmark:Status

Any text

Sets the text of a Form field shown in the status bar.

FormField: bookmark:Checked

Y or N

Y sets the check boxes of a Form Field in the Checked state. N removes the check boxes.

FormPassword

0 or "" (an empty value)

0 protects the result document with Form Fields with an empty password. An empty value protects the result document with an unknown password.

ChangePassword

0 or "" (an empty value)

0 protects the result document with an empty password. An empty value protects the result document with an unknown password. This function activates the same password as the function FormPassword but without enabling the Form Field protection feature.