Dividing a report body into multiple columns often gives a compact design with an improved look and feel.
JasperReports offers full flexibility of displaying your reports in multiple columns and provides a number of tools to enhance the look of multi-column reports.
In this simple recipe, you will learn how to convert your single-column report into a multi-column report.
Refer to the installPostgreSQL.txt
file included in the source code download of this chapter to install and run PostgreSQL, which should be up and running before you proceed. The source code of this chapter also includes a file named copySampleDataIntoPGS.txt
, which helps you to create a database named jasperdb7
and copy sample data for this recipe into the database.
GroupInGroupMultiColumns.jrxml
file from the Task1
folder of the source code of this chapter. The Designer tab of iReport shows a report containing data in the Title, Customer Group Header 1, Product Group Header 1, and Detail 1 sections, as shown in the following screenshot:Notice the vertical bar you saw in step 5 of the recipe. The bar has no significance in report designing. This means you can place components on each side of the bar or even right on the bar.
However, the bar is actually a caution sign for you while designing multi-column reports. Notice that you placed all components on the left side of the bar. If you place components on the right of the bar, it will generate an ambiguous display. There will be two major ambiguities in the display:
You can try dropping something on the right of the bar to see this ambiguity. If you take care and don't place anything on the right side of the bar, JasperReports will handle your multi-column report perfectly even if it spans multiple pages.
18.116.15.161