Getting started with jasper-reports

Download jasper-reports eBook

Remarks

There are several libraries used JasperReports Java API for creating reports with Java:

This libraries/frameworks can build reports "on fly" with or without using report's template (jrxml file)

Versions

JasperReports library

VersionRelease date
6.3.02016-06-20
6.2.02015-11-11
5.6.02014-05-27
5.5.02013-10-24
5.0.42013-03-26
5.0.02012-11-12
4.8.02012-11-05
4.7.02012-07-02
4.6.02012-05-21
4.5.02011-12-06
4.1.12011-04-18
4.0.02010-12-31
3.7.62010-10-27
3.7.52010-09-22
3.7.02009-12-08
3.6.02009-08-31
3.5.32009-07-29
3.5.02009-03-25
3.1.42009-02-10
3.1.22008-11-04
3.1.02008-09-17
3.0.12008-08-07
3.0.02008-05-19
2.0.52008-03-12
2.0.32007-12-12
2.0.02007-08-14
1.3.42007-06-11
1.3.02006-12-22
1.2.82006-11-14
1.2.02006-02-06
1.1.02005-10-21
1.0.32005-10-10
1.0.02005-07-20
0.6.82005-05-31
0.2.32002-02-06

IDE for designing reports

The current version of designer is based on Eclipse: Jaspersoft Studio.

The previous version of designer was based on NetBeans: iReport Desigher.

The first version of iReport Designer was independent appliсation - iReport Classic

Installation or Setup

JasperReports Library

JasperReports is a open source Java based reporting tool. The JasperReports Library can be downloaded from the Jaspersoft Community for the latest release.

In recent releases the third-party jars in the lib folder are not distributed, they need to be download from public repositories, see distributed pom.xml for dependencies. Maven can be used to retrieve all dependencies including the transient ones in the target/dependence folder.

mvn dependency:copy-dependencies
 

Jaspersoft Studio (IDE)

Jaspersoft Studio is the official design client for JasperReports--built on the Eclipse platform--to replace iReport Designer.

iReport Designer (IDE)

iReport Designer is the previous report designer for JasperReports. Version 5.6.0 (released in May of 2014) was the last official version; vendor support ended at the end of 2015.


JasperReport Commuity resources

JasperReports Library FAQs

Source code

Tutorials

Samples

References

Official Bug Tracker

Jasper report file formats

  • .jrxml is the report design file, it's format is in human readable XML, it can be complied into a JasperReport object and saved as a .jasper
  • .jasper is the compiled version of the .jrxml and can be loaded directly into a JasperReport object ready to be filled with data
  • .jrprint is the serialized JasperPrint object, a report that have already been filled with data and can be loaded to be printed, viewed and/or exported to desired format.
  • .jrpxml is the XML rappresentativo of a JasperPrint object it can be modified and then unmarshaled to retrieve the JasperPrint object

Understanding the different report bands

Title

This band is showed once at the beginning of the report. It can be used as first page by setting the attribute isTitleNewPage="true"

Page Header

This appears at the beginning of each page excluding first page if Title band is used and last page if Summary band is used with setting isSummaryWithPageHeaderAndFooter="false"

Column Header

This appears before the detail band on each page.

Detail

This section is iterated for each record in datasource supplied. It is allowed to have multiple detail band (detail 1, detail 2 .. detail n), the are iterated as follows

Row 1
    detail 1
    detail 2
    detail n
Row 2
    detail 1
    detail 2
    detail n
 

Column Footer

This appears below the detail band on each page where detail band is present. The default setting is end of page (before Page footer) but this can be switch to under last detail band (last record) by setting the attribute isFloatColumnFooter="true"

Page Footer

This appears at the bottom of each page excluding title band, summary band (without page footer) and last non summary band if Last Page Footer is used.

Last Page Footer

This appears on last page (if not summary band without page footer) instead of normal Page Footer

Summary

This appears at the end of the report in new page if isSummaryNewPage="true" is set and with page header and footer if isSummaryWithPageHeaderAndFooter="true"

Group Header

This section appears if a group is defined every time the group expression change, before the detail band.

Group Footer

This section appears if a group is defined every time before the group expression change, after the detail band.

Background

This band is displayed on every page as background to all other bands.

No Data

This appears only if no datasource was passed or the datasource is empty (0 records) and whenNoDataType="NoDataSection" is set.

Work flow

The work flow in jasper-reports is:

  1. Design the report, create the jrxml file that defines the report layout. The jrxml can be create by using a simple texteditor but normally an IDE (JasperSoft Studio or iReport) is used both to speed up report development but also to have a visual view of layout.
  1. Compile the report (the jrxml) to get a .jasper file or a JasperReport object. This process can be compared with a .java file being compiled to .class .
  1. Fill the report, pass parameters and a datasource to the report to generate the print object JasperPrint that can also be saved to a .jprint file
  1. View, print and/or export the JasperPrint. The most commons export format are supported as pdf, excel, word, html, cvs etc.

Stats

165 Contributors: 4
Saturday, September 10, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook