Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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:

  1. <style>.<pattern>.<reportLanguage>

  2. <style>.<pattern>

  3. <pattern>.<reportLanguage>

  4. <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 of the pattern cells is evaluated, then copied. All ${...} expressions in the content will be treated as JavaScript expressions on report specific data. The expression can access the following identifiers:

Identifier

Description

Example

data

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.

${data.mainTitle}

translate

Render inline language dependent content. Takes an ITranslations dictionary object mapping languages to translations.

${translate({ de: "Konto", en: "Account", fr: "Compte" })}

format

Formatter for dates and date periods, where the Excel formats cannot be used.

${translate({ de: "Seit", en: "Since" })} ${format(data.startDate)}

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:

  1. <style>.<pattern>.<reportLanguage>

  2. <style>.<pattern>

  3. <pattern>.<reportLanguage>

  4. <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

header

Rows at the top of a worksheet. Content data is taken from the node creating the new worksheet and the report.:

Code Block
languagetypescript
data: {
  mainTitle?: string;
  subTitle?: string;
  reportName: string;
  params: object // Execution Parameters 
}

✔️

Code Block
languagejson
"data": {
  "mainTitle": <node"Rückforderbare mainTitle>Quellensteuern",
  "subTitle": <node subTitle>"Vom 01.01.2024 bis 31.03.2024",
  "reportName": <report"Rückforderbare name>Quellensteuern",
  "params": {
    "portfolioId": <report execution parameters> "00001",
    "reportingDate": "2024-03-31",
    ...
  }

footer

Rows at the bottom of a worksheet. Content data is the same as for the header.

✔️

As for header.

issue

Cell created when an issue is encountered (e.g. a missing mandatory pattern). Content data is the issue.:

Code Block
languagetypescript
data: Issue

Code Block
languagejson
"data": {
  "id": <issue id>"rep-2024-03-31-15-6",
  "description": <issue description>"Cell pattern 'data' to stamp DataNode 'returns' not found",
  "severity": "error",
  "source": "rendering"
}

...

For all supported nodes, the following parameters are considered:

Parameter

Description

Content Example

style

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.

Code Block
languagejson
"parameters": {
  "style": "ReclWhTax",
  ..."
}

pageBreakBefore

Whether this node should be rendered at the top of a new worksheet.

Code Block
languagejson
"parameters": {
  "pageBreakBefore": true
}

renderingOptions.excel.worksheetName

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 pageBreakBefore: true.

Note that Excel limits the length of worksheet names to 31 characters

.repeatHeaders: Mark tableHeader and columnHeaders to be repeated on each page (VerticalTableNode only). If there are multiple VerticalTableNodes rendered into a single worksheet, only the headers of the last one with this option will be repeated

.

  • 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.

  • Code Block
    languagejson
    "parameters": {
      "renderingOptions": {
        "excel": {
          "worksheetName":  {
            "resolved": "Rückforderbare QST"
          },
     
        "repeatHeaders": true
        }
      },
      ...
    }

    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 VerticalTableNodeIf 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

    Content Example

    columnHeaders

    Row(s) to be stamped for the column headers of the table, repeated if renderingOptions.excel.repeatHeaders: true. Content data are the header texts by column id:

    Code Block
    languagetypescript
    data: Record<string,string>

    Code Block
    languagejson
    "data": {
      "ValueDate": "Valutadatum",
      "TradeDate": "Ex-Datum",
      "TransactionId": "Trx-Id",
      "Amount": "Betrag"
    }

    row.<importance>
    row.<importance>.<indent>

    Row(s) to be stamped for each data row in the table. A different cell pattern must be specified for each row importance (row.1, row.2 etc.). If a row specifies an indent, there must be a cell pattern for the importance and indent (row.1.1, row.1.2 etc.).

    Content data are the table facts by column id:

    Code Block
    languagetypescript
    data: Record<string,number | string | boolean | Date | null>

    data.rowName contains the row name, if set.

    Code Block
    languagejson
    "data": {
      "ValueDate": "2024-02-14T00:00:00Z", // as Date instance
      "TradeDate": "2024-02-12T00:00:00Z", // as Date instance
      "TransactionId": "41567",
      "Amount": 11424.3
    }

    rowGroup.<importance>

    Row(s) to be stamped for each row group carrying a name. Content is the group name:

    Code Block
    languagetypescript
    data: { groupName: string }

    Code Block
    languagejson
    "data": {
      "groupName": "Current Account EUR"
    }

    tableHeader

    Rows to be stamped before the column headers, repeated if renderingOptions.excel.repeatHeaders: true. Content data is the same as for header.

    ✔️

    See header.

    tableFooter

    Row to be stamped after the last table row. Content data is the same as for header.

    ✔️

    See header.

    Generic Table Rendering

    VerticalTableNodes 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.

    Column related pattern names therefore contain the value type:

    Pattern Name

    Description

    Optional

    Content Example

    columnHeader.<valueType>

    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 renderingOptions.excel.repeatHeaders: true.

    Content data is the header text:

    Code Block
    languagetypescript
    data: { header: string }

    Code Block
    languagejson
    "data": {
      "header": "Betrag"
    }

    fact.<valueType>.importance
    fact.<importance>

    Row(s) and column(s) to be to be stamped for each fact in the table. A different cell pattern should be specified for each value type (fact.text.1, fact.amount.1 etc.), and must be specified for each row importance (fact.1, fact.2 etc.).

    Content data is the fact value:

    Code Block
    languagetypescript
    data: { value: number | string | boolean | Date | null }

    Code Block
    languagejson
    "data": {
      "value": 11424.3
    }

    rowName.<importance>

    Row(s) and column(s) to be stamped for the row name, if set.

    Content data is the row name:

    Code Block
    languagetypescript
    data: { rowName: string }

    Code Block
    languagejson
    "data": {
      "rowName": "Gebühren- und Zinsabrechnung"
    }

    rowGroup.<importance>

    Same as []

    See above.

    tableHeader

    ✔️

    See header.

    tableFooter

    ✔️

    See header.

    Note

    Generic tables can only be rendered if there is no columnHeaders pattern in any of the templates used (main template and configured templates). It is therefore a good idea to always prefix columnHeaders with a style if a template is also used for generic tables.

    VerticalTableNode Parameters

    Parameter

    Description

    Example

    renderingOptions.excel.repeatHeaders

    Mark tableHeader and columnHeaders to be repeated on each page (VerticalTableNode only).

    If there are multiple VerticalTableNodes rendered into a single worksheet, only the headers of the last one with this option will be repeated.

    Code Block
    languagejson
    "parameters": {
      "renderingOptions": {
        "excel": {
          "repeatHeaders": true
        }
      }
    }

    renderingOptions.excel.tableWidth

    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 columnWeight. If not specified, column widths are taken from the cell patterns.

    For templated tables, this parameter is ignored.

    Code Block
    languagejson
    "parameters": {
      "renderingOptions": {
        "excel": {
          "tableWidth": 115
        }
      }
    }

    Worksheets: SectionNode

    A SectionNode renders its titles, and may start a new worksheet.

    ...