Merging Table Cells Dynamically
This feature is supported by version 19.1 or greater
The code uses some of the objects defined in The Business Layer.
Merging Table Cells Dynamically
Using GroupDocs.Assembly for Java, you can merge table cells with equal textual contents within your reports dynamically using cellMerge tags. Syntax of a cellMerge tag is defined as follows:
<<cellMerge -horz>>
A horz switch is optional. If the switch is present, it denotes a cell merging operation in a horizontal direction. If the switch is missing, it means that a cell merging operation is to be performed in a vertical direction (the default).
For two or more successive table cells to be merged dynamically in either direction by the engine, the following requirements must be met:
- Each of the cells must contain a cellMerge tag denoting a cell merging operation in the same direction.
- Each of the cells must not be already merged in another direction.
- The cells must have equal textual contents (ignoring leading and trailing whitespaces).
Consider the following template:
... | ... | ... |
... | <<cellMerge>><<[Variable1]>> | ... |
... | <<cellMerge>><<[Variable2]>> | ... |
... | ... | ... |
The cellMerge tag works only if Variable1 and Variable2 have the same values.