Posted by Nagesh Chauhaan | Last Updated: 04-Sep-14
JasperReports provides the necessary features to generate dynamic reports, including data retrieval using JDBC (Java Database Connectivity), as well as support for parameters, expressions, variables, and groups. JasperReports also includes advanced features, such as custom data sources, scriptlets, and subreports. All in all, JasperReports combines good features, maturity, community participation, and, best of all, it's free.
In this blog, we will cover a series of tutorial on “Jasper Reports” . Following are the topics that we w’ll cover here
Understanding iReport Elements
In this part of tutorial we w’ll start our discussion with a basic overview of iReport Elements and their formats.
The complete structure of report is composed with a set of sections called bands. Each band has its own dimensions and a particular position in the report, and is used for a particular objective. The available bands are: Title, Page Header, Column Header, Detail 1, Column Footer, Page Footer, Last Footer, and Summary.
The basic structure of a report can be seen in the following screenshot.
There are different bands with specific functions and properties. Here is a brief overview of there bands:
Title It is the vary first band of the report and is printed only once . This area is used to print title of the document and the information that is needed only once in whole iReport.
Page Header This is like a title per page and printed on each page of the report . This is used to setup header information on the page .
Column Header Like page header this band prints on each page,but it prints only if there is a detail band on that page.
Detail This is the most usefull and tricky band of all , This band is repeatedly prints for each row in the data source. In the List of emp_detail report, it is printed for each emp_detail.
Column Footer Is printed on each page if there is a detail band on that page. If the Floating column footer in report Properties is checked, then the column footer will be shown just below the last data of the column, otherwise it will be shown at the bottom of the page (above the page footer).
Page Footer This area is usefull place to insert page numbers. If Last Page Footer is set thab this page prints on each page except the last page,and If Last Page Footer is not set, then it is printed on the last page also.
Last Page Footer This prints at the end of the document , all finishing text and information can be printed in this area.
Summary This is used to conclude the document and it prints only once at the end of the report.
Background This portion is used to set a background image for the document , it is a good place to insert a watermark image for report pages
Apart from these tags there is an another usefull tag ‘No Data’, as the name suggest this band print, when no data is available for the report.
Properties for bands
Now, we are going to learn how to configure these bands according to our needs .
Select Title from the Report Inspector. You will see the Column Footer - Properties on the left of the designer.
Now you will see the Title - Properties on the right of the designer.
We can set band properties from here and customize our report .
Deleting and adding a new band
To add a new band go to Report-Inspector and select the required band and press add:
Like wise to delete a band select the band from Report-Inspector and press Delete Band :
This w'll give a brief introduction about what 'Jasper Reports' are and how to use them , in next part we w'll cover 'How to create a basic iReport in Jasper ' .
Hope it helps !