Template Structure

A template is a JRXML file. When a new report is created, the JRXML file of the selected template is loaded and modified according to any options you have specified in the wizard steps. If the user chooses not to use the wizard, the selected template is just copied along with all the referenced images in the location the user has specified.

When the Report Template dialog box appears, it scans all paths specified as template directories. Any valid JRXML files found are included in the Report Template dialog box. If a template provides a preview image, the image is displayed. Otherwise, a white box appears.

Default Report Templates

A template contains all or some of the same parts as a report. When creating a new template or editing an existing template, it is important to remember the following:

Every band has the same size in the template and in the report generated from the template. For example, if your template has a Detail band with a height of 100 pixels and a Summary band with height of 10 pixels then every report generated with this template has by default a Detail band with a height of 100 pixels and a Summary band with a height of 10 pixels.
Page formatting is the same in a report in the template that generates it. For example, if your template or A4 paper with half-inch margins, any report using that template uses an A4 paper with half-inch margins.
The content of the Summary, Title, Page Header and Page Footer bands, as well as the background, is static. Every element that is placed in these bands in a template appears in every report that uses this template.
In the Column Header band there should be only a Static Text element, and its text content must be Label. The appearance, font and the other attributes of this label create every label that is inserted in this band.
In the Group Header band there should be only a Text Field with the string “GroupField” (including the double quotes). As with the Column Header this assumes an example to generate every field that goes in this band.
In the Detail band there should be only a Text Filed with the string “Field” (including the double quotes). Again, this is used to generate every field that goes in this band.

When you group data using the wizard, the wizard creates all the necessary report structures to produce the requested groups. The Report Wizard permits the creation of up to four groups, and a group header and group footer is associated with each. If the template defines one or more groups and you group the data, the wizard tries to use any existing groups before creating new ones. By default, groups in the template are deleted if they are not used. For each group, the wizard sets the group expression and adds a label for the name and a text field showing the value of the group expression (which is always a field name, since the grouping criteria set using the wizard is one of the selected fields).

Version: 
Feedback