Table of Contents | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Principles of Operation
The Excel Channel renders supported nodes from the abstract report by copying cell patterns from the Excel template(s) and “stamping” them on the Excel report:
Cell The cell style is taken from the template.
Cell context The cell value is taken from data in the report.
Unsupported nodes are silently ignored, thus a report intended for Word or online should always (at least partially) be convertible to an Excel document.
...
See https://bmpi.atlassian.net/wiki/spaces/CRDOC/pages/3252125697/Working+with+Excel+Templates#Supported-Node-Types for the names to be assigned.
Style and Language Specific Cell Patterns
Whenever a pattern is searched for a node with a specific style, the following names are checked in order:
<style>.<pattern>.<reportLanguage>
<style>.<pattern>
<pattern>.<reportLanguage>
<pattern>
Example: the header
pattern when rendering a node with style MyStyle
in language de
will be the first existing one of MyStyle.header.de
, MyStyle.header
,header.de
, header
.
Stamping Cell Patterns
Cell patterns are stamped as follows:
The style of the pattern cells is copied to the stamped cells next rows (or columns for generic tables) in the Excel report. This includes format, font, row height and column width, alignment, wrapping, colors, conditional formatting, merging, etc.Some patterns are optional. These are only rendered if defined in the template.
The content value of the pattern cells is evaluated, then copied. All
${...}
expressions in the content value will be treated as JavaScript expressions on report specificdata
. The expression can access the following identifiers:
Identifier | Description | Example |
---|---|---|
| The data to be rendered. This is e.g. a node, a row header, a table fact or a report specific data object. See https://bmpi.atlassian.net/wiki/spaces/CRDOC/pages/3252125697/Working+with+Excel+Templates#Supported-Node-Types for details. |
|
| Render inline language dependent content. Takes an |
|
| Formatter for dates and date periods, where the Excel formats cannot be used. |
|
Style and Language Specific Cell Patterns
Whenever a pattern is searched for a node with a specific style, the following names are checked in order:
<style>.<pattern>.<reportLanguage>
<style>.<pattern>
<pattern>.<reportLanguage>
<pattern>
...
Some patterns are optional. These are only rendered if defined in the template.
Templates
The template handling of the Excel channel is very similar to the Word Channel. Each Excel report needs at least a main template to render correctly:
...
For all supported nodes, the following cell patterns are may be rendered:
Pattern Name | Description | Optional | Content Example Data | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Rows at the top of a worksheet. Content Value data is taken from the node creating the new worksheet and the report.:
| ✔️ |
| ||||||||||
| Rows at the bottom of a worksheet. Content Value data is the same as for the | ✔️ | As for | ||||||||||
| Cell created Cells stamped when an issue is encountered (e.g. a missing mandatory pattern). Content Value data is the issue.:
| ❌ |
|
...
Parameter | Description | Example | |||||
---|---|---|---|---|---|---|---|
| The style to apply. Used as name prefix when looking for cell patterns, see https://bmpi.atlassian.net/wiki/spaces/CRDOC/pages/3252125697/Working+with+Excel+Templates#Style-and-Language-Specific-Cell-Patterns. |
| |||||
| Whether this node should be rendered at the top of a new worksheet. |
| |||||
| The Excel Channel rendering options. The supported options are: worksheetName : Name name of the worksheet if this node creates a new worksheet, i.e. it is the first node or has Note that Excel limits the length of worksheet names to 31 characters .
tableWidth : The total width of all columns of a generically rendered table, see https://bmpi.atlassian.net/wiki/spaces/CRDOC/pages/3252125697/Working+with+Excel+Templates#Generic-Table-Rendering. |
|
Tables: VerticalTableNode
Not surprisingly, a VerticalTableNode
is rendered as rows and columns in Excel. There are two ways of rendering an table in Excel: styled templated and generic.
...
Templated Table Rendering
By specifying a style on the VerticalTableNode
If there is a columnHeaders pattern (maybe with matching style prefix and language suffix), the table will be rendered row by row. Each row, including the header row, corresponds to a cell pattern. Styled Templated rendering therefore allows full control over the layout in Excel and as well as subselection and reordering of columns.
Pattern Name | Description | Optional | Example Data | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Row(s) to be stamped for the column headers of the table, repeated if
| ❌ |
| ||||||||||
| Row(s) to be stamped for each data row in the table. A different cell pattern must be specified for each row importance ( Value data are the table facts by column id:
| ❌ |
| ||||||||||
| Row(s) to be stamped for each row group carrying a name. Value data is the group name:
| ❌ |
| ||||||||||
| Rows to be stamped before the column headers, repeated if | ✔️ | See | ||||||||||
| Row to be stamped after the last table row. Value data is the same as for | ✔️ | See |
Generic Table Rendering
VerticalTableNode
s without a style
are If there is no columnHeaders
pattern, a VerticalTableNode
is rendered in a generic way. This mode of rendering is similar to the Word Channel: each column is rendered individually, depending on its value type. Typical value types are text
, amount
, count
, date
. The basic idea is that the style of a column (particularly format and alignment) depends on its value type.
Info |
---|
Pattern names containing a value type with a hyphen ('-') need to be written with a underscore ('_') instead (e.g. p-abs is written as p_abs in the template). |
Column related pattern names therefore contain the value type:
Pattern Name | Description | Optional | Example Data | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Row(s) and column(s) to be stamped for the column headers. A different cell pattern must be specified for each value type ( Repeated if Value data is the header text:
| ❌ |
| ||||||||||
| Row(s) and column(s) to be to be stamped for each fact in the table. A different cell pattern must be specified for each value type ( |
...
Value data is the fact value:
| ❌ |
| |||||||||||
| Row(s) and column(s) to be stamped for the row name, if set. Value data is the row name:
| ❌ |
| ||||||||||
| ❌ | See above. | |||||||||||
| ✔️ | See | |||||||||||
| ✔️ | See |
Note |
---|
Generic tables can only be rendered if there is no matching |
VerticalTableNode
Parameters
Parameter | Description | Example | |||||
---|---|---|---|---|---|---|---|
| Mark If there are multiple |
| |||||
| The total width (in Excel units, see e.g. https://learn.microsoft.com/en-us/office/troubleshoot/excel/determine-column-widths) of all columns of the generic table. This width will be distributed among the columns according to their For templated tables, this parameter is ignored. |
|
Titles: SectionNode
A SectionNode
renders its titles, and may start a new worksheet..
Pattern Name | Description | Optional | Example Data | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Rows to be stamped for a section. Value data is taken from the node:
| ❌ |
|
Simple Text: ParagraphNode
A ParagraphNode
is renders its titles and its content.
Pattern Name | Description | Optional | Example Data | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Rows to be stamped for a paragraph. Value data is taken from the node:
| ❌ |
|
Arbitrary Data: DataNode
A DataNode
renders the contents of its data object. It can be used to render arbitrary content data to the Excel document, as the type of the data object itself is user defined.Since the cell patterns depend on the type of data in the object, a DataNode
must have a style
.. This allows to render relatively complex objects into a large cell pattern.
Pattern Name | Description | Optional | Example Data | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Rows to be stamped for the data object. Value data is taken from the node:
If the data is an array, the pattern is stamped for each array element. | ❌ |
|
Production Errors: ErrorNode
An ErrorNode
(typically the result of an error during report production) renders the error details.
Pattern Name | Description | Optional | Example Data | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Rows to be stamped for an error. Value data is taken from the node:
| ❌ |
|
Debugging Excel Rendering
If the report parameter addExcelTrace
is true
, the rendering process is traced for each pattern, and the trace appended to the Excel document as worksheet "Pattern Usage Trace".
The trace will contain a line for each cell pattern stamped (including attempts non-existing patterns). It contains the following columns:
Column | Description |
---|---|
| The type of the abstract report node. |
| The id of the abstract report node. |
| The id of the element when rendering table rows, columns, groups or facts. |
| The destination range being stamped. |
| The pattern used to stamp. Empty if nothing was stamped. |
| The patterns tried before |
| The data being stamped. |
Example trace
...