What it does
This node assigns header cells to data cells in complex tables using header IDs. Header cells can also be assigned to other header cells. This allows you to map tables with multi-level headers, where a subheader belongs to a higher-level header. A cell can be assigned several header cells. Header IDs that are already assigned remain, and new ones are added.
First, the Child Cell Expression narrows down the cells that should be assigned to a header cell. The node then searches in the specified Header Cell Position (for example, above or to the left of the found child cells) for suitable header candidate cells. You can narrow these candidates down further with the Header Cell Expression.
When matching header cells are found, each one receives a unique ID and is tagged as TH. This ID is then assigned to the child cells as their header reference.
Tip
Use the Set Table Attributes Node to add table summaries, header scopes and cell spans.
Use it for
Use the Define Header Cells node for complex tables where the relationship between header cells and data cells can't be expressed through scopes alone. Examples include tables with multiple header rows, cell spans, or irregular header structures.
Recommended workflow:
- Create the table structure with the Detect Table node or the Tabulate node.
- Pass the result to the Define Header Cells node.
- If a cell needs headers in more than one direction (e.g. column headers above and row headers to the left), connect two Define Header Cells nodes in sequence, one for each search direction.
- For tables with multi-level headers, use an additional Define Header Cells node that selects the lower-level header cells as child cells and assigns them to the higher-level header cells.
How to use it
- Drag and drop the node from the Node Library into your template:
Node Library > Folder Tagging - Connect the node with other nodes in the Data Flow of your template.
- Specify the settings in the Node Properties task pane.
Node Input
Tables: Connect a node containing shape trees with table structures. Examples are tables created by the Detect Table node or the Tabulate node.
Node Output
Tables: Outputs the tables from the input with new TH tags on the defined header cells. The child cells are connected to their header cells by header IDs.
Node Properties
Node Name
You can assign a custom name to the node to help identify its purpose within your template.
Child Cell Expression
Defines which cells should be assigned a header cell. The expression is evaluated for each cell in the table. Only cells for which the expression returns true are used as child cells.
Available variables:
-
table: shape tree of the table currently being processed from the Tables input list.tablehas the same properties as a shape tree object. -
childContent: shape tree with the content of the current cell, i.e. all content inside the cell container.childContenthas the same properties as a shape tree object. -
rowIndex: zero-based row index in a single table -
colIndex: zero-based column index in a single table -
rowCount: total number of rows in a single table -
colCount: total number of columns in a single table -
firstRow: refers to all cells in the first row in a single table -
lastRow: refers to all cells in the last row in a single table -
firstCol: refers to all cells in the first column in a single table -
lastCol: refers to all cells in the last column in a single table
Expected return type: boolean
Example:
rowIndex > 0 and colIndex > 0
All cells outside the first row and first column are assigned a header cell. This is useful for tables where the first row and first column contain header cells.
Header Cell Position
Defines where the header cells are located relative to the child cells. Starting from each child cell, the node searches in this direction for header candidate cells.
Options:
- Header above child cell
- Header below child cell
- Header left of child cell
- Header right of child cell
Note
Each node searches in one direction only. If child cells need header cells in more than one direction (e.g. above and to the left), connect two Define Header Cells nodes in sequence and select a different position in each node. The order of the nodes doesn't matter, because header IDs assigned by earlier nodes are kept.
Header Cell Expression
Defines whether a header candidate found in the specified Header Cell Position is a valid header cell for the child cell. The expression is evaluated for each candidate. Candidates for which the expression returns true are defined as header cells, receive a unique ID and are assigned to the child cell.
Available variables for the child cell found by the Child Cell Expression:
-
table: shape tree of the table currently being processed from the Tables input list.tablehas the same properties as a shape tree object. -
childContent: shape tree with the content of the current cell, i.e. all content inside the cell container.childContenthas the same properties as a shape tree object. -
childRowIndex: zero-based row index of the child cell -
childColIndex: zero-based column index of the child cell
Available variables for the header candidate cell:
-
headerContent: shape tree with the content of the header candidate cell, i.e. all content inside the cell container.headerContenthas the same properties as a shape tree object. -
headerRowIndex: zero-based row index of the header candidate cell -
headerColIndex: zero-based column index of the header candidate cell
Available variables for the table:
-
rowCount: total number of rows in a single table -
colCount: total number of columns in a single table -
firstRow: refers to all cells in the first row in a single table -
lastRow: refers to all cells in the last row in a single table -
firstCol: refers to all cells in the first column in a single table -
lastCol: refers to all cells in the last column in a single table
Expected return type: boolean
Example:
headerRowIndex = 0
Only candidates in the first row are defined as header cells.
Examples
Example 1: Column headers in the first row
| Property | Value |
|---|---|
| Child Cell Expression | rowIndex > 0 |
| Header Cell Position | Header above child cell |
| Header Cell Expression | headerRowIndex = 0 |
All cells below the first row are assigned the header cell from the first row above them.
Example 2: Row headers in the first column
| Property | Value |
|---|---|
| Child Cell Expression | colIndex > 0 |
| Header Cell Position | Header left of child cell |
| Header Cell Expression | headerColIndex = 0 |
All cells to the right of the first column are assigned the header cell from the first column to their left.
Example 3: Column and row headers
For a table with headers in both the first row and the first column, connect two Define Header Cells nodes in sequence. Configure the first node as in Example 1 and the second node as in Example 2. The order of the two nodes doesn't matter.
Example 4: Multi-level column headers
In this table, the first row contains higher-level headers (e.g. "2025" and "2026"). The second row contains subheaders below them (e.g. "Q1", "Q2"). Connect two Define Header Cells nodes in sequence. The order of the two nodes doesn't matter.
First node: assign the subheaders to the higher-level headers
| Property | Value |
|---|---|
| Child Cell Expression | rowIndex = 1 |
| Header Cell Position | Header above child cell |
| Header Cell Expression | headerRowIndex = 0 |
The subheaders in the second row are assigned the higher-level headers from the first row.
Second node: assign the data cells to the subheaders
| Property | Value |
|---|---|
| Child Cell Expression | rowIndex > 1 |
| Header Cell Position | Header above child cell |
| Header Cell Expression | headerRowIndex = 1 |
All data cells below the second row are assigned the subheaders from the second row.