#cell
The system object #cell can be used to access properties and information of an individual cell in a table. The system object is available both in the Table function as well as in the format template with the abbreviation td .
The general syntax is:
$CMS_VALUE(#cell.METHOD)$
The individual method invocations are listed in the following:
Invocation | Meaning | Return data type |
---|---|---|
#cell.align | Returns the value selected by the editor for alignment in the cell. Possible values are: | String |
#cell.attr("IDENTIFIER") | Returns the value selected or entered by the editor for a user-specific attribute in the cell. User-specific attributes can be specified with the propertyConfig parameter in the input component DOMTABLE . | String |
#cell.bgcolor | Returns the value selected by the editor for the background colour in the cell. The background colour corresponds to the pre-defined bgcolor attribute of the propertyConfig parameter in the input component DOMTABLE. | String |
#cell.col | Returns the column number of the cell. The counting begins with 0. | |
#cell.colNumber | Returns the column number of the cell. The counting begins with 1. | |
#cell.colspan | Returns the number of horizontally joined (merged) cells. | |
#cell.firstCell | Determines whether the cell is the first cell in a row. | Boolean |
#cell.firstRow | Determines whether the cell is in the first row of the table. | Boolean |
#cell.firstRowAndCell | Determines whether the cell is the first cell of the table. | Boolean |
#cell.lastCell | Determines whether the cell is the last cell in a row. | Boolean |
#cell.lastRow | Determines whether the cell is in the last row of the table. | Boolean |
#cell.lastRowAndCell | Determines whether the cell is the last cell of the table. | Boolean |
#cell.remainingCols | Determines the number of remaining columns in a row including the current cell. I.e. if a row has four columns and the cell is output in the row the value returned by #cell.remainingCols is 4. | |
#cell.remainingRows | Determines the number of remaining rows, starting from the current row position. The counting includes the current row. I.e. if the table contains four rows and the cells of the first row are rendered the value returned by #cell.remainingRows is 4. | |
#cell.row | Returns the row number of the cell. The counting begins with 0. | |
#cell.rowNumber | Returns the row number of the cell. The counting begins with 1. | |
#cell.rowspan | Returns the number of vertically joined (merged) cells. | |
Examples of #cell
Several examples of use of the instruction within templates are shown in the following. The examples are intended to clearly show the specific effect of the instruction and provide help for the template developer when creating their own templates.
The examples displayed here must be adjusted for use within a project! For example, variable names must be changed to the specific variable names of the project in which the instruction is to be used. |
1st Example: Table cell with merging, background colour and alignment
<td
$CMS_IF(#cell.rowspan > 1)$
rowspan="$CMS_VALUE(#cell.rowspan)$"
$CMS_END_IF$
$CMS_IF(#cell.colspan > 1)$
colspan="$CMS_VALUE(#cell.colspan)$"
$CMS_END_IF$
style="
$CMS_IF(!#cell.bgcolor.isEmpty)$
background-color:$CMS_VALUE(#cell.bgcolor)$;
$CMS_END_IF$
$CMS_IF(!#cell.align.isEmpty && (#cell.align != "left"))$
text-align:$CMS_VALUE(#cell.align)$;
$CMS_END_IF$
"
>
$CMS_IF(#content.isEmpty)$
$CMS_ELSE$
$CMS_VALUE(#content)$
$CMS_END_IF$
</td>
In the example it is first checked whether more than one cell is vertically joined. If this is the case the number of vertically joined cells is output prepared for HTML. In the next step it is checked whether more than one cell is horizontally joined. If this is the case the number of horizontally joined cells (prepared for HTML) is output. Then a check is made to see whether the properties for the background colour and the alignment in the cell are set. Finally another check is made to see whether content has been entered for the cell. If this is the case the content is output, otherwise a space.
Output example:
<td
colspan="2"
style="background-color:#220022;"
>
A cell content
</td>