Book Image

JasperReports 3.6 Development Cookbook

By : Bilal Siddiqui
Book Image

JasperReports 3.6 Development Cookbook

By: Bilal Siddiqui

Overview of this book

<p>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.<br /><br />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.<br /><br />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.<br /><br />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.<br /><br />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.</p>
Table of Contents (13 chapters)
JasperReports 3.6 Development Cookbook
Credits
About the Author
About the Reviewers
Preface

Expanding a field vertically to accommodate large text


This recipe teaches you how to handle the presentation of dynamic data in text fields, which can contain large amounts of data. Large dynamic text scenarios occur when your report contains sentences, the exact word count of which is not known while designing a report and will be determined during report processing (for example, a sentence that contains the name and address of a company). In such situations, the large text size can overflow the size of the field and, therefore, wrapping to the next line may become essential.

Getting ready

Refer to the installPostgreSQL.txt file included in the source code download for this chapter to install and run PostgreSQL, which should be up and running before you proceed. The source code for this chapter also includes a file named copySampleDataIntoPGS.txt, which helps you create a database named jasperdb3 and copy sample data for this recipe into the database.

How to do it...

  1. 1. Open the VerticalStretch...