Document generation. Problems and Solutions
To generate documents by templates, an important task is to reduce the number of templates. The fewer the templates, the easier it is to maintain and make changes to them. This can be achieved if the patterns are polymorphic, i.e. will contain redundancy. Depending on the generation parameters, the excess parts during document generation will be deleted and as a result only those parts that are required will remain. Let's mark, for example, the text of the template as follows:
The text of part 1.
Permanent text.The text of part 2.
Let's pass to the generator what needs to be removed in the parameters (or leave ) As a result, we get:
Constantly present text. The text of part 2.
For the logical operation AND (do not delete if selected and ) markup can be as follows:
The text of part 1.
Permanent text.The text of part 2.
For logical operation OR (delete if selected or ) markup can be as follows:
||The text of part 1.
Permanent text.The text of part 2.
We list the advantages and disadvantages of this method of marking up templates.
Advantages:
- in one template can contain many thematically related documents.
- The markup is quite simple and can be done by non-IT employees. If you have a good tool for developing templates, a competent person in the subject area will be able to perform such markup, and he will not need to work with an IT intermediary incompetent in the subject.
- it is possible to get from the entire list of fields to fill with the information contained in the template, a list of fields that will remain after removing excess fragments from the template.
Disadvantages:
- markup without a special developer tool is poorly read.
- the sizes of the templates become very large, which can lead to a decrease in the generation speed if special measures are not taken.
To deal with the large size of the templates, you can use the method of breaking the template into parts, where the parts are stored separately from the template and inserted into it only if there are parameters passed to the generator. This significantly reduces the size of the template, and hence the generation time. The template is divided into parts automatically by the template development environment if there is a special markup in the template, which indicates in which cases the part should be inserted into the main template.
Permanent text.
Let's pass to the generator what needs to be removed in the parameters
Constantly present text. The text of part 2.
For the logical operation AND (do not delete if selected
Permanent text.
For logical operation OR (delete if selected
Permanent text.
We list the advantages and disadvantages of this method of marking up templates.
Advantages:
- in one template can contain many thematically related documents.
- The markup is quite simple and can be done by non-IT employees. If you have a good tool for developing templates, a competent person in the subject area will be able to perform such markup, and he will not need to work with an IT intermediary incompetent in the subject.
- it is possible to get from the entire list of fields to fill with the information contained in the template, a list of fields that will remain after removing excess fragments from the template.
Disadvantages:
- markup without a special developer tool is poorly read.
- the sizes of the templates become very large, which can lead to a decrease in the generation speed if special measures are not taken.
To deal with the large size of the templates, you can use the method of breaking the template into parts, where the parts are stored separately from the template and inserted into it only if there are parameters passed to the generator. This significantly reduces the size of the template, and hence the generation time. The template is divided into parts automatically by the template development environment if there is a special markup in the template, which indicates in which cases the part should be inserted into the main template.