Text Blocks

Inserting Text Blocks

The template developer can insert a Text Block that has been created with the Text Block Editor in the master template. To do so, the template developer should know the name of the Text Block that needs to be inserted and the location (path). In legacy projects, the location (path) is optional, but you must also know project where the Text Block resides.

Besides this, in legacy projects, the template developer needs to know the names of the Field Sets that could be used by the Text Block. For each Field Set a FIELDSET needs to be declared. The fields from the Field Set can then be assigned a value.

The template developer should also make sure that the Microsoft Word styles that are used in the Text Blocks are defined.

To insert the Text Block in the master template, use the Content Wizard. Alternatively, you can use the TEXTBLOCK keyword. This keyword needs at least the name of the Text Block. It is also possible to use the instruction TEXTBLOCK to insert more than one Text Block. This can be used if a user selected more than one Text Block in a MULTISELECT Text Block question. All Text Blocks selected by the user can be inserted in the master template using the instruction TEXTBLOCK. The field or array that holds the Text Block names can be passed to the instruction TEXTBLOCK using the instruction VAR.

The instruction TEXTBLOCK has extended options to lay out Text Blocks in many different styles or to insert a Text Block in a table.

The field that stores answers to a MULTISELECT Text Block question is a CSV file. The template developer can use the split_csv function to split the field in separate Text Block names that can be used in the master template.

Using Text Blocks in a Form

Text Blocks can be organized in Text Block Lists. Text Block Lists are collections of Text Blocks and are, just like Text Blocks, created and maintained with the Communications Manager Designer. Text Block Lists can be used in Forms. Users can select one of more Text Blocks from a Text Block List when the template is run, The selected Text Blocks can be inserted in the result document.

There are 2 ways to create a Form:

  1. FORM keyword

  2. Form Editor

Forms created with the FORM instruction save the answers to the questions in the Form to variables or arrays. The Text Block that are selected by the user when a template is run are saved in a variable or array as well. The Text Blocks can be inserted in the result document using the instruction TEXTBLOCK.

Text Block questions in the Form Editor

With the Text Block editor Text Block questions can be created. A Text Block List can be selected from which the user can select on or more Text Blocks. A selected Text Block can be inserted in the result document in two ways:

  • Text Blocks can be inserted directly in the result document using the option Auto insert Text Blocks. The text selected Text Block(s) will be inserted in the result document at the location the Form is used in the master template.

  • Text Blocks can be saved to a field. In that case the template developer should use the instruction TEXTBLOCK to insert the Text Block in the result document.

Text Blocks layout

Text Block that are inserted in the result document are laid out according to a set of especially declared styles The following styles are used for the lay out of a Text Block:

Style Description
ITP_normal Basic style. This style is used when no lay out has been applied to the Text Block.
ITP_normal_x Basic style for indentation. This style is used for Text Block that use indentation. x should be replaced by the level of indentation.
TP_header Basis style for the header.
TP_header_x Style for the header. x should be replaced by the level of indentation.
ITP_numbered_list Basic style for a numbered list.
ITP_numbered_list_x Style for a numbered list. x is the level of nesting.
ITP_bullet_list Basic style for a bulleted list.
ITP_bullet_list_x Style for a bulleted list. x is the level of nesting.

The template developer is responsible for defining the correct styles. An error will be generated if template is run in which a style is used in a Text Block that has not been defined in the master template.

An example document 'Text Block styles' with example styles is by default created in the Styledocuments folder of a new project. This document is by default configured as Style Document on the project. Refer to the Tungsten Communications Manager Repository User Guide for an explanation on Style Documents.

Defining alternate styles

It might be needed to lay out Text Blocks in several different styles with one document. Therefore it is possible to define different sets of styles. These sets must be defined with the same name as described above. The prefix ITP should be replaced by an alternate prefix to distinguish between different style sets.

Use the STYLE_PREFIX option of the statement TEXTBLOCK to insert the Text Block with an alternate style in the result document. This statement allows for passing the prefix of the style set that should be used to lay out the Text Block.

Inserting Text Blocks in tables

Text in a table cell is handled differently by Microsoft Word than text outside table cells. Therefore, inserting a Text Block in a table cell with the insert_text_block function could cause errors. To insert Text Block text in a table cell the option STYLE_PREFIX should be used. This option allows to pass the paragraph sign that needs to be used while inserting the Text Block. If a paragraph sign created within a table cell is passed, the Text Block can be inserted in the table cell without causing errors.

Example 1

In the following example the Text Block with label App1 is inserted in the result document. With this Text Block the field set Appealfields is associated. This field set contains the fields Date and Type.

The template developer needs to declare a FIELDSET variable with the name Appealfields because Text Block set Appeal is associated with field set Appealfields. The fields from this field set should be assigned a value. The Text Block is inserted in the result document using the instruction TEXTBLOCK.

Example 2

The following example shows how to use the FORM construction to show a question to the user in which a Text Block can be selected. The Text Block View from which the user can select a Text Block is called Clauses. The Text Block is stored in the variable with the name selected_text_block.

The Text Block is not associated with a field set therefore no FIELDSET variable needs to be declared.