PacktLib: JasperReports 3.6 Development Cookbook

JasperReports 3.6 Development Cookbook


About the Author

About the Reviewers


Creating Static and Dynamic Titles and Headers


Downloading, installing, and running JasperReports and iReport

Creating your first "Hello World" report

Creating and sizing the title for your report

Using dynamic titles that can change during report processing

Inserting a company logo in the title of your report

Adding a simple header to your report

Setting margins for your report and aligning the report header relative to report margins

Working with the Body and Footer of your Report


Displaying a field along with its label in the body of your report and handling null values

Creating a simple table of records along with labels for each column

Inserting a heading for a group of records

Using parameters to filter records during report processing

Implementing groups within groups — a nested hierarchy

Adding a simple footer to your report

Displaying general information or summary at the end of your report

Enhancing the Look and Feel of your Report


Deploying and reusing styles in your report

Setting background color for data

Using HTML tags and bullet lists

Expanding a field vertically to accommodate large text

Applying formatting pattern to the value of a data field

Using background images and watermarks in your report

Working with a Variety of Data Sources


Creating a report from relational data

Connecting to an XML datasource

Creating a report from XML data using XPath

Using multiple relational databases to generate a report

Creating a report from model beans of Java applications

Multi-page Reports


Building a cover page for your multi-page report

Creating a simple, one-page TOC for your report

Applying a style to your simple TOC

Resetting page numbering with the start of a particular record

Implementing complex multi-dimensional page numbering

Showing multiple types of data in the same report

Managing pagination of multiple types of data in a report

Multi-column Reports


Dividing the body of a report into multiple columns

Displaying groups of data in separate columns

Displaying data as name-value pairs in multiple columns

Filling your report horizontally in multiple columns

Using subreports to design a multi-column report

Summary Report, Crosstabs, and Graphs


Designing a simple summary report

Designing a multi-level summary report

Designing a crosstab—a table with dynamic rows and columns

Displaying data trends as a graph in your report

Embedding a bar graph inside a tabular view

Java Wrappers for your JasperReports


Creating a Java wrapper for your report

Compiling and viewing your report in a Java Swing application

Printing the hardcopy of your report using a Java Swing application

Creating an Excel report from a Java Swing application

Creating a JasperReport on the fly in a Java web application