The styles template

Overview

Instead of repeatedly defining similar styles for each report, you can define a style in the styles library and reuse it in other reports. To achieve this you can use a style template (called also Styles Library in iReport), which is a container where one or more styles are stored. In this container there must be only styles.

Creation of a Template

From JasperSoft Studio open the menu File->New->Style Template File

Now select the folder in your workspace where to put the template file and the name of the file. Then hit Finish.

Now a new style template will be created, with already a style in it. At this point you can create new styles by right clicking on the Styles node, into the Outline view, and select "Create Style".

To edit a style simply select it and edit its properties from the property tab, like you do in a normal report.

Using of a template inside the a report

Open a report, right click on the Styles node into the Outline View and select "Create Style Template".

Now a new dialog will be opened and from here you can select a style template created before. Select the style and hit Ok.

Now you can use the styles defined in the imported template in a similar way of the normal styles. Just select an element and from its properties use the one named "Style". Here you will find a combobox showing the available styles. But note that are shown only the internal ones, the external ones (which comes from a template) must be selected by typing directly their names.

Feedback