4.2. Report Template

You can create several templates for a single report in the Templates tab of the report editor. One of them must be selected as the default template in the Report structure tab.

Below is the form to add a template:

report template
Figure 32. Template Editor
  • Template code – template code for its identification.

  • Template file – template file, which is loaded from the file system and saved to the database along with the report structure description.

  • Output type – report output type. It should be consistent with the template file type according to the rules described in Output format compliance matrix.

  • Output name pattern – optional file name pattern, which will be used for the produced report download. It can either be a constant string or contain report parameter as a variable, e.g. ${header.authorName}.xlsx. More sophisticated patterns with several parameters and string concatenation can also be created as a script in any band of report structure, e.g. ${Root.title}.xlsx, where title is a result of the script:

    [['title' : ('Report for '+params['author'].firstName+' '+params['author'].lastName)]]
  • Is custom – the flag to use custom formatting logic not covered by any provided formatter.

  • Defined by – the way the custom template is defined: by a class, script or URL.

  • Custom definition – the fully qualified name of the Java class, the path to the Groovy script in the core module, or the URL used to create the template.

  • Is alterable output – the flag to let the user choose the output type of a report at runtime in a dialog window.

    If the flag is on, a dialog with output type selection will be shown when running a report. If the report has more than one template, the template selection dropdown will be shown as well.

    report template alterable
    Figure 33. Alterable Output