You are previewing JasperReports 3.6 Development Cookbook.
O'Reilly logo
JasperReports 3.6 Development Cookbook

Book Description

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.

  • 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

  • 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.

    Create and enhance your business reports using the various functionalities of JasperReports and iReport

    Table of Contents

    1. JasperReports 3.6 Development Cookbook
      1. JasperReports 3.6 Development Cookbook
      2. Credits
      3. About the Author
      4. About the Reviewers
      5. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      6. 1. Creating Static and Dynamic Titles and Headers
        1. Introduction
        2. Downloading, installing, and running JasperReports and iReport
          1. How to do it...
          2. There's more...
            1. Download and install iReport for Linux, Mac OS X, and Solaris
            2. Download older versions of iReport for Windows, Linux, Mac OS X, or Solaris
        3. Creating your first "Hello World" report
          1. How to do it...
          2. How it works...
        4. Creating and sizing the title for your report
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Aligning multiple components simultaneously
        5. Using dynamic titles that can change during report processing
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Inserting a company logo in the title of your report
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Adding a simple header to your report
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        8. Setting margins for your report and aligning the report header relative to report margins
          1. Getting ready
          2. How to do it...
          3. How it works...
      7. 2. Working with the Body and Footer of your Report
        1. Introduction
        2. Displaying a field along with its label in the body of your report and handling null values
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Creating a simple table of records along with labels for each column
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Inserting a heading for a group of records
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Using parameters to filter records during report processing
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Implementing groups within groups — a nested hierarchy
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Adding a simple footer to your report
          1. How to do it...
          2. How it works...
        8. Displaying general information or summary at the end of your report
          1. Getting ready
          2. How to do it...
          3. How it works...
      8. 3. Enhancing the Look and Feel of your Report
        1. Introduction
        2. Deploying and reusing styles in your report
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Setting background color for data
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Using HTML tags and bullet lists
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Expanding a field vertically to accommodate large text
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Applying formatting pattern to the value of a data field
          1. Getting ready
          2. How to do it...
        7. Using background images and watermarks in your report
          1. Getting ready
          2. How to do it...
      9. 4. Working with a Variety of Data Sources
        1. Introduction
        2. Creating a report from relational data
          1. Getting ready
          2. How to do it...
          3. There's more...
        3. Connecting to an XML datasource
          1. Getting ready
          2. How to do it...
        4. Creating a report from XML data using XPath
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Using multiple relational databases to generate a report
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Creating a report from model beans of Java applications
          1. Getting ready
          2. How to do it...
          3. How it works...
      10. 5. Multi-page Reports
        1. Introduction
        2. Building a cover page for your multi-page report
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Creating a simple, one-page TOC for your report
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Applying a style to your simple TOC
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Resetting page numbering with the start of a particular record
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Implementing complex multi-dimensional page numbering
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Showing multiple types of data in the same report
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Managing pagination of multiple types of data in a report
          1. Getting ready
          2. How to do it...
          3. How it works...
      11. 6. Multi-column Reports
        1. Introduction
        2. Dividing the body of a report into multiple columns
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Displaying groups of data in separate columns
          1. Getting ready
          2. How to do it...
        4. Displaying data as name-value pairs in multiple columns
          1. Getting ready
          2. How to do it...
        5. Filling your report horizontally in multiple columns
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Using subreports to design a multi-column report
          1. Getting ready
          2. How to do it...
          3. How it works...
      12. 7. Summary Report, Crosstabs, and Graphs
        1. Introduction
        2. Designing a simple summary report
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Designing a multi-level summary report
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Designing a crosstab—a table with dynamic rows and columns
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Displaying data trends as a graph in your report
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        6. Embedding a bar graph inside a tabular view
          1. Getting ready
          2. How to do it...
      13. 8. Java Wrappers for your JasperReports
        1. Introduction
        2. Creating a Java wrapper for your report
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Compiling and viewing your report in a Java Swing application
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Printing the hardcopy of your report using a Java Swing application
          1. Getting ready
          2. How to do it...
        5. Creating an Excel report from a Java Swing application
          1. Getting ready
          2. How to do it...
        6. Creating a JasperReport on the fly in a Java web application
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...