Text templates

1C:Enterprise 8 Designer supports an ability to create, save and paste quickly a frequently used text fragments. These text fragments are called templates, and to manage a list of templates, the developer can use a special window:

1C:Enterprise 8 - Text templates

All the templates are stored in files and the developer can create a new file of templates or attach the existing ones:

1C:Enterprise 8 - Text templates

Each template is a collection of static and dynamic parts. The static part is not changed and is displayed in the form in which it is specified in the template. The context of dynamic part depends on the usage context and can be changed.

The developer may create the new and edit the existing templates. Editing of templates is performed in a special window that contains a list of templates and the text of the selected template. The dynamic part of template is allocated with the special symbols < >:

1C:Enterprise 8 - Text templates

When editing the text document or module, a quick paste of template is possible after the sequence of characters specified in template will be typed. For example, for template If illustrated on figure, it is possible to type in module a word If and, by pushing the key, to call a template paste:

1C:Enterprise 8 - Text templates

Since two templates have a similar sequence of replaceable characters, we should select a template we need and specify the context of its dynamic part:

1C:Enterprise 8 - Text templates

As a result, the following text will be inserted in the module:

1C:Enterprise 8 - Text templates

Besides, there is an opportunity of direct paste of any template by its selection from the context menu.

The text templates support the use of its dynamic part for query builder and format string designer.

For example, to form the dynamic part of the following template, a query builder will be called:

1C:Enterprise 8 - Text templates

And when using this template, the format string designer will be called:

1C:Enterprise 8 - Text templates

The text templates can also use the selection window of configuration objects to fill the dynamic part:

1C:Enterprise 8 - Text templates

Leave a Reply

Your email address will not be published. Required fields are marked *

1C:Enterprise Developer's Community