Text Template Editor

Text Template Format
Structure of the service part of an area
     Keywords to describe fields
     Text part of an area
Automatic Wrapping of Values in Area Fields

If “Text Template” selected as the template type in the template wizard, the text editor is opened in text template input mode.

If “Text Template” is selected as the template type in the template wizard, the text editor is opened in text template input mode.

Text Template Format

The entire template text is divided into areas. The areas have to follow each other and cannot overlap or include each other. Areas in the template text are identified as follows:

#Area XXXXX
#EndArea

where XXXXX is the area name.

The area end need not be specified. Declaring the beginning of an area means that the previous area has ended.

To save multilingual versions of an area, you can insert the code of the language for which the area was written after the area name:

#Area Heading1 RU
#EndArea

#Area Heading1 EN
#EndArea

If no language code is specified for an area version, this area version will be returned when a language code not specified in any area description version is passed to the GetArea method.

Each area consists of strings containing service parameters and template strings. Control directives of the text template are specially highlighted in the text strings:

#Area XXXXX

[service part]
[text part]

#EndArea

The service part has no visible borders. It contains all the strings from the beginning of the area that begin with the special # character. The service area describes the parameters of the text template fields used within the area. If the service part is unnecessary, it may be omitted.

Structure of the service part of an area

The service part consists of descriptions of some common area parameters and descriptions of the fields that make up the area. All the descriptions given in the service part apply only within the area. If a field's format is described in some area and the field occurs in another area without a format description, the default format will be used for it there.

The service part of an area can begin with the common area keyword #ReplaceChar A B.
If this keyword is used, a character replacement will be performed inside the area's strings.

A is the character to be replaced, and B is the replacement character. Characters must be enclosed in single quotes.

For instance, if we write #ReplaceChar '@' '#', then all occurrences of @ in strings that are not part of field names will be replaced by #.

It makes sense to use this keyword in cases when the format of a template string must contain the # character (using it directly would mark the text as service).

Keywords to describe fields

After the replacement keyword description comes a description of the fields used in the area.

A field is created using the keyword #Field FFFF, where FFFF is the name of the field to be described.

Then the next lines contain keywords for the field description. The field description applies up to the beginning of the next field description.

#Alignment {Left | Right | Center | Justify} specifies the field's alignment within its allocated space.

#Field WorkType
    #Alignment Justify

#Format <Format string> specifies the format string for field output.

#Field Date1
    #Format Justify

#Field Tm1
    #Format "ND=4; NFD=0; NDS=."

#Fill <Parameter> specifies the need to fill the field's allocated space with # characters. If <Parameter> = True and the field's contents do not fit in the allocated space, filling will occur.

#Field ReportTotal
    #Format "ND=18; NFD=2; NDS=."
    #Fill True

Text part of an area

The text part of an area consists essentially of the text template strings. It begins after the last string belonging to the service part of the area and continues up to the end of the area. Inside the lines of the text template its fields are specified: for this, the field's name is indicated in square brackets: [FFFF].

Example.
------------------------------------------------------------------
!  [Name           ][Code         ] ! [Name           ] !
------------------------------------------------------------------

The number of spaces allocated to the field is equal to the number of spaces occupied by the bracketed field name.

If more spaces must be allocated, you can pad the field name by adding spaces on the left or right. If you pad the field name with spaces on the left, the system will right-justify the field, and if you add spaces on the right, it will left-justify it. If you pad both sides of the field name, it will be centered within the allocated space.

If the field name is longer than the number of spaces allocated, the name is specified with the key word Field. E.g.:

#Field Number
     #Format "ND=3; NFD=0"
#Field Code
     #Format "ND=5; NFD=0"
#Field Label
     #Format "ND=1"

-------------------------------------------
![ ]![Code  ][Name       ]! [! #Field Number Label
-------------------------------------------

Specify parameters in the keyword Field only for those fields whose names are not specified in brackets in the body of the template.

Automatic Wrapping of Values in Area Fields

When the text does not fit in the allocated field size, it may be necessary to use automatic wrapping to a new line. To do this, we recommend a field placement instruction in the template, using braces and angle brackets.

  • {FFFF} means the field area is limited by the braces. They show that automatic wrapping of text stored in field FFFF to that line is permitted and specify the space for text not previously fit into text field FFFF . Even if the string does not require output of any of the fields, the string will be output anyway.
  • <FFFF> means the field area is bounded by the angle brackets. They show that automatic wrapping of the text saved in field FFFF is permitted and specify the space for what didn't fit on the previous line in the field FFFF. If all the fields contained in the string are specified in angle brackets, but none of them was required for text output, the string will not be output. If the text still will not fit when the text is output from the field to the string in which the field is contained in angle brackets, the string will be duplicated until the entire text can be output from the field.

Example.
---------------------------------------------
[        YY][XX           ]![       ZZ]!
!             !  {XX           }!           !
!             !  <XX           >!           !
---------------------------------------------

This example shows that field XX fits on the first line. The part of field XX that did not fit on the first line is placed on the second line. The part of field XX that did not fit on the first or second lines is placed on the third line. If field XX had no text left for the third line, that line is not output at all, but if it did have text left, the third line will be output until the text from field XX ends.

1C:Enterprise Developer's Community