All mult-iline directives such as #if, #else, #elseif, #foreach, and #macro must be used under the following conditions:
The beginning and ending statements must be declared within a single cell. The two figures below show two samples of invalid usage of the multi-line statements between cells.
Since the body of the #if statement is contained in the cell A2, this cell will not be generated if the condition is not true (the element type is not “usecase”). Due to the constraints of spreadsheet document structure, the number of cells in a column must be equal to the number of cells in all columns, and the number of cells in a row must be equal to the number of cells in all rows. |
VTL Macro must be declared within a single cell. Do not insert the multi-cell recorded macros in a single cell, see figure below.
The macro will copy all contents between #macro and #end. Cells and rows will be included in the macro as well. Once this record has been inserted, the macro content will break the document’s structure.
The #foreach directive can only be used in a single cell record. To create data for multiple rows, use the #forrow directive instead, see figure below.
As shown in figure below, the output will be:
#forcol is used to create data for multiple columns, see figure below. This statement can be used with #forrow (see the sample from the “Other Document” template).
From the usage of #forcol shown in figure below, the output will be: