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:
Follow the wizard through until you have exported a JasperReports .jrxml template file. The wizard will prompt you to do the following:
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:
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.