Before designing a report we must understand what different types of bands, parameters, fields and many other settings.
Jasper report design contain 10 bands in it they are
- Page Header
- Column Header
- Column Footer
- Page Footer
- Last Page Footer
- No Data
We will have a good look about what are the above bands functionalities in details. Whatever we discuss about each band get a picture of print file in your mind so that you will have a great understanding of the band functionalities.
Every invoice has a Title and it only appears once in your entire invoice, don’t get confused that it appears only once in your invoice. Just imagine you have a print file it contains more than 10 pages of its own, but if you clearly observe the main heading only appears in the first page but not in the remaining pages.
So Headings or some text whatever you want to show only on the first page you can write or show it on the Title band.
Lets us assume the same 10 pages example, but here whatever we try to display in the Page Header will be displayed in all the 10 pages of your generated report file.
To understand the purpose of the column header you need to see an example of a table.
Table name: market
In the above table example we can see a table with column names and its description in it. The column names Fruits, Vegetables and Drinks are the column names and the description list followed.
So when you compare the same situation in out designing the columns names must be shown in the column header. And the field names $F(name) must show in the Details Band, don’t get worried what actually is $F(name), we will discuss in detail about it later.
Detail band plays an important role in designing our reports. For now we will have a small understanding about Fields name in our Jasper report Designing. Field names ($F(name)) are actually generated in your query processing of your jasper report.
Let us consider the same table market with values like in MySQL.
To get the total table values we write a query like.
select fruits, vegetables, drinks from market
When you pass the above query in our jasper report at “DataSet and Query Editor Dialog” and click on Read Fields, the Fields names are generated with class type below. The Field name will be generated as $F(fruits), $F(vegetables) and $F(drinks).
So the generated Fields names must be passed in Details Band.
Column Footer band and Page Footer band are having the same functionalities, but the only difference, may you got a question what are the functionalities of the two bands. Whatever we are trying to show in this band will be displayed in all the generated pages, but only difference is the position will be different. The result of the Column Header will be displayed right after the Details Band data and Page Footer data will be displayed at the end point.
Column Footer band and Page Footer band are having the same functionalities of displaying the data. But the page footer is displayed at the end of the every generated page.
Example we can show something like page number, printed date in the generated report.
Last Page Footer
Title band and Last Page Footer are having opposite functionalities, like explained in title band whatever we try to display in the Title band will be shown only in the first page of generated report.
And here whatever we write try to display in Last Page Footer band will be displayed at the last page of the generated pages.
Whatever we try to display in the summary band will be shown right next to the Detail band in designing our jasper report.
The name itself says No Data, Noting will be displayed whatever we try to show in the No Data band. You might be having a question if there is no use of the No Data band why it is present in the report.
Most commonly every back-end and front-end languages have comments which will be not show at compile time. Comments are actually used to describe or say something important about the work done within it, so that the other person can easily understand the code.
So No Data band can be used for the same purpose in report generating.
Background band has the complete accesses of you entire page from top to bottom of the designed page, Background band is most commonly used for Background water marks text with light shades.