Getting started with jasper-reports
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
Version | Release date |
---|---|
6.3.0 | 2016-06-20 |
6.2.0 | 2015-11-11 |
5.6.0 | 2014-05-27 |
5.5.0 | 2013-10-24 |
5.0.4 | 2013-03-26 |
5.0.0 | 2012-11-12 |
4.8.0 | 2012-11-05 |
4.7.0 | 2012-07-02 |
4.6.0 | 2012-05-21 |
4.5.0 | 2011-12-06 |
4.1.1 | 2011-04-18 |
4.0.0 | 2010-12-31 |
3.7.6 | 2010-10-27 |
3.7.5 | 2010-09-22 |
3.7.0 | 2009-12-08 |
3.6.0 | 2009-08-31 |
3.5.3 | 2009-07-29 |
3.5.0 | 2009-03-25 |
3.1.4 | 2009-02-10 |
3.1.2 | 2008-11-04 |
3.1.0 | 2008-09-17 |
3.0.1 | 2008-08-07 |
3.0.0 | 2008-05-19 |
2.0.5 | 2008-03-12 |
2.0.3 | 2007-12-12 |
2.0.0 | 2007-08-14 |
1.3.4 | 2007-06-11 |
1.3.0 | 2006-12-22 |
1.2.8 | 2006-11-14 |
1.2.0 | 2006-02-06 |
1.1.0 | 2005-10-21 |
1.0.3 | 2005-10-10 |
1.0.0 | 2005-07-20 |
0.6.8 | 2005-05-31 |
0.2.3 | 2002-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
Work flow
The work flow in jasper-reports is:
-
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.
-
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
. -
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 -
View, print and/or export the JasperPrint. The most commons export format are supported as pdf, excel, word, html, cvs etc.
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.
Jasper report file formats
-
.jrxml
is the report design file, it’s format is in human readable XML, it can be complied into aJasperReport
object and saved as a.jasper
-
.jasper
is the compiled version of the.jrxml
and can be loaded directly into aJasperReport
object ready to be filled with data -
.jrprint
is the serializedJasperPrint
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 aJasperPrint
object it can be modified and then unmarshaled to retrieve theJasperPrint
object