Report Options
Overview
ReportOptions are used to control various rendering settings and default values for a report template. These options are set using the options field of the template or by defining ExternalOptions. ReportOptions is also where shared styles can be defined for use throughout the template's components.
ReportOptions Schema
| key | type | required | description |
|---|---|---|---|
| enableDebug | boolean |
optional | Turns on debug highlighting for all components in the report. |
| showTokens | boolean |
optional | Enables display of string replacement tokens in the rendered report if corresponding data is not found. Default value is true. |
| size | string |
optional | The output size to use for the report. Current options are letter or legal. If not defined, letter is used. |
| orientation | string |
optional | The desired orientation for the report. Options are Portrait or Landscape. |
| margins | Margins |
optional | The page margins to use for the report. |
| background | Background |
optional | An object describing the background options for the report. Backgrounds can be solid colors or gradients. If not defined, a default white background is used. |
| defaultTextOptions | TextOptions |
optional | Defines the default text formatting to use for all text in the report. These defaults can be overridden at each component using the style system. |
| defaultTableOptions | TableOptions |
optional | Defines the default layout/formatting to use for all tables in the report. These defaults can be overridden at each table component using the style system. |
| styles | Style[] |
optional | Defines the shared styles to use in the report. |
External Options
Report options can optionally be loaded from external files. This allows for defining report settings one time and then sharing them across many different report templates. This ability is most useful for defining shared styles. Each external options file can optionally define a conditional so that styles are applied only when specific criteria are met. For example, it is possible to create a report template that is styled differently depending on the FI identifier. Or, custom styles could be applied for a report designed for an end-customer depending on their account type.
File Type
An external report options file must use the filename extension .opt.json. The JSON must be formatted to meet the ReportOptions schema.
Merging ReportOptions
If multiple options files are imported into a single report template, the options are merged together. For example, all styles from each external options file are imported and available to use for all components in the report. If multiple styles with the same identifier are imported, the last one imported takes precedence. This allows for overriding a shared style at the report level. Additionally, all other settings are also merged with each defined setting, replacing the one that came before it.
External Options Schema
| key | type | required | description |
|---|---|---|---|
| filename | string |
required | The name of the options file to import into the report template. |
External Options Example
The report template below defines 4 external ReportOptions files. The first is always included and the second and third are included only when their conditionals evaluate to true. The last file uses data substitution to load a file using a path that is generated dynamically when rendering the report.
{
"id": "CALL_CODE",
"name": "Call Code",
"description": "Portfolio Summary By Call Code",
"creator": "Aaron Watson",
"version": "1.0",
"externalOptions": [
{
"filename": "Global.opt.json"
},
{
"filename": "Call Code.opt.json",
"condition": "opt1"
},
{
"filename": "Call Code2.opt.json",
"condition": "opt2"
},
{
"filename": "@(fi_id)/@(branch_id)/BranchStyles.opt.json"
}
]
...
}
Margins
Defines the margins to add to a report.
Margins Schema
| key | type | required | description |
|---|---|---|---|
| left | integer |
required | The size of the left margin in pixels. |
| top | integer |
required | The size of the top margin in pixels. |
| right | integer |
required | The size of the right margin in pixels. |
| bottom | integer |
required | The size of the bottom margin in pixels. |
Margins Example
The example below shows how to set the margins for a report.
{
"id": "JHA-EA-RPT-1",
"name": "Report 1",
"description": "My first report",
"creator": "Aaron Watson",
"version": "1.0",
"options": {
"defaultTextOptions": {
"font": "arial",
},
"margins": {
"top": 10,
"left": 10,
"bottom": 10,
"right": 10
}
},
"components": [
{
"type": "Text",
"text": "Report Title"
}
]
}