Free Sample
+ Collection

JasperReports 3.6 Development Cookbook

Bilal Siddiqui

If you’re a Java developer who wants to make the most of the world’s most popular open source reporting engine, this book is all you need: a step-by-step course in creating super-attractive, user-friendly business reports.
RRP $29.99
RRP $49.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849510769
Paperback396 pages

About This Book

  • Create, size, and position the titles, headers, footers, and body of your report using JasperReports and iReport
  • Enhance the look and feel of your report using background images, watermarks, and other such features
  • Create multi-page and multi-column reports using multiple types of data in the same report
  • Generate reports from Java Swing applications or from your web application
  • Part of Packt's Cookbook series: Each recipe is a carefully organized sequence of instructions to complete the task as efficiently as possible.

Who This Book Is For

This book is for Java developers who want to use JasperReports to create user-friendly business reports. It is for those who may be familiar with JasperReports but want to dive into advanced JasperReports activities.

If you know how to use Microsoft Word you can also learn how to design business reports using iReport by following the recipes of this cookbook.

Although the primary audience of this cookbook are report designers, however Java and XML developers will find this book useful in understanding how Jasper’s XML code works and how to wrap JasperReports functionality in your Java Swing or Web applications.

Table of Contents

Chapter 1: 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
Chapter 2: 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
Chapter 3: 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
Chapter 4: 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
Chapter 5: 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
Chapter 6: 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
Chapter 7: 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
Chapter 8: 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

What You Will Learn

  • Create, position, and enhance the title, header, footer, and body of your report
  • Use dynamic titles—those that can change during report processing
  • Use mathematical and logical expressions to calculate sum, average, maximum, and to sort, arrange, and extract data making it easier for you to analyze, share, and manage business information more effectively
  • Create a report from various data sources such as relational data, XML data, or model beans of Java applications
  • Create multi-page reports, with a cover page and table of contents (TOC) and manage pagination of multiple types of data
  • Use sub-reports to design a multi-column report
  • Design simple or multi-level summary report, and cross-tabs
  • Create bar charts and graphs to show data trends
  • Generate reports from Java Swing applications or web applications

In Detail

JasperReports is the world's most popular embeddable Java open source reporting library, providing Java developers with the power to easily create rich print and web reports. While such reports are pivotal in managing business information more effectively, creating and customizing them can get tedious.

This book will give you recipes to solve common JasperReports problems to make your life easier. It will take you through complex examples related to JasperReports with step-by-step instructions on how to solve them.

The author's experience in creating reports enables him to share over 50 recipes to develop crystal-clear business reports using the capabilities of JasperReports and the amazing features provided by its visual report designer tool: iReport.

This cookbook will arm you to develop user-friendly reports by using multiple types of data in the same report, thereby saving your time in sorting, arranging, or extracting data and making the whole process effortless. First you will learn to do basic things such as creating, sizing, positioning, and enhancing the titles, headers, footers of the report. You will move on to working with the body and footer of the report, including using parameters to filter records during report processing and implementing nested hierarchy. Second, you will learn to enhance the look and feel of your report by deploying and reusing styles, and by using designs, textual effects, background images, and watermarks. You will also learn to use mathematical and logical expressions such as counting the number of records with a particular field value, grouping records, applying styles on your data based on logical or mathematical conditions, and so on.

Then you will be able to do advanced things such as working with a variety of data sources: relational data, XML data, model beans of Java applications, and also multiple relational databases at once. You will learn to build a cover page and table of contents for multi-page reports, display multi-dimensional page numbering, and much more. You will be able to design simple and multi-level summary reports, cross-tabs with dynamic rows and columns, create bar charts, and display data trend graphs in your reports. Lastly and very importantly, you will be able to generate reports from Java Swing applications after you learn how to use JavaWrappers for your JasperReport.


Read More