Step 4 - edit layout

Click here to download the complete files for all steps in this tutorial.

You now have all the basic information and graphics in the report but the layout could still be improved. Jaspersoft Studio is Jaspersoft’s free open-source report designer. Using Jaspersoft studio you can edit the report’s layout, change fonts, images sizes, add images such as your company’s logo etc…

Now export the report design as a Jasper Reports template:

  • For ODL Studio version 1.0.0, from the report wizard (the wand icon in the toolbar on the report script editor's bottom right toolbar), select the option in the pop-up menu to export jasper reports template (portrait).
  • For later ODL Studio versions, on the Export and processing options tab, press the export portrait template button under tools.

Follow the wizard through until you have exported a JasperReports .jrxml template file. The wizard will prompt you to do the following:

  1. Choose a title for your report.
  2. Choose an output directory for the exported report files.
  3. Choose a file prefix for the exported report files.

The exported files will be named [file prefix][your table name].jrxml and [file prefix][your table name].jasper. As the table name in this tutorial is Customers, if you set the file prefix to be Export1 then the files will be named Export1Customers.jrxml and Export1Customers.jasper. Alternatively if you leave the prefix empty they will be named Customers.jrxml and Customers.jasper.

Next download Jaspersoft studio and install it on your computer. You can then open the .jrxml file in Jaspersoft studio and edit its layout as you require using the visual report designed. The .jrxml file is Jaspersoft’s raw report template file, however JasperReports needs the compiled template file with the file extension .jasper to generate a report. Once you have finished editing, save the .jrxml file and go back into ODL Studio. Now compile your modified report template:

    • For ODL Studio version 1.0.0, in the reporter script editor, click the compile report template button which is located at the bottom of the editor:

  • For later versions, press the compile .jxrml button on the Export and processing options tab.

When you select this option, a file browser dialog will ask you to select the .jrxml file to compile; select your saved .jrxml file.  A .jasper file will then be generated with same filename and location as the .jrxml.

You should then select the Export and processing options tab and ensure the Compiled report template box is set to the newly compiled .jasper file:

If you click play (the blue arrow icon) to run the script, the reporter component will use the newly compiled .jasper file to generate the final report, which will then open in the report viewer control.

The zip archive file for this tutorial contains the example files basic customer report.jrxml and edited customer report,jrxml which contain the report design before and after editing in Jaspersoft Studio, together with their .jasper files and exported pdfs. The following screenshot shows the first page of edited customer report.pdf. We used Jaspersoft Studio to change the title, make it larger, place borders around each row and remove some of the column names as well as other miscellaneous changes:

Using the options under Export and processing you can disable the report viewer control and / or configure the reporter to export to a variety of formats. For example, if you wanted to make the reports available online you could export them to html.

Go to next tutorial