JasperReports - Getting Started



What is a Report

A report is a meaningful, well-defined, and summarized presentation of information. Usually, the routine activities are automated and data summarized into a decision-supporting "Reports". Reports represent usual messy data into charts, graphs, and other forms of graphical representations.

Report Template

Generally, the following layout is adopted to generate reports by most of the commercial report generating tools.

TITLE
PAGEHEADER
COLUMNHEADER
DETAIL
COLUMNFOOTER
PAGEFOOTER
SUMMARY

Following are the descriptions of each element mentioned in the diagram −

S.NO Element and Description
1

title

Title contains the 'Title' of the report. It appears only once at the very beginning of the report, for example, "Tutorials Point Report."

2

pageHeader

PageHeader may contain date and time information and/or organization name. This appears at the top of each page.

3

columnHeader

ColumnHeader lists the names of those specific fields, which you want to display in the report, for example, "Author Name," "Starting Hour," "Finishing Hour," "Hours Worked," "Date," etc.

4

detail

Detail is the part where entries of the specific fields (listed in columnHeader) are shown, for example "Manisha", "9:00", "18:00", "9", "10.02.2013."

5

columnFooter

ColumnFooter may display summation of any of the field, for example, "Total Hours Worked: "180."

6

pageFooter

PageFooter may contain page count information. It appears at the bottom of each page, for example, "1/23."

7

summary

Summary contains information inferred from "detail" part, for example, after listing the number of hours, worked by each author, total hours worked by each author can be put in visual chart like pie chart, graph, etc. for better comparison.

JasperReports

Following are the common troubles faced during the report development −

  • Core changes − Usually, reflect the business changes or enhancements it is required to change the core logic of the report.

  • Results exporting − There are a wide range of formats, which your report can be exported to, such as: HTML, Text, PDF, MS Excel, RTF, ODT, Comma-separated values, XML, or image.

  • Complicated reports − sub-reports and cross-tabs reports are good example.

  • Charts reports − Visual charts for example, Graph, Pie, XY Line, Bar, Meter, and Time series.

To remove the overhead of the above mentioned points and to facilitate the reporting process, a lot of frameworks, tools, libraries, and 3rd parties applications were introduced. JasperReports is one of them.

JasperReports is an open source java reporting engine. It is Java based and doesn't have its own expression syntax. JasperReports has the ability to deliver rich content onto the screen, to the printer, or into PDF, HTML, XLS, RTF, ODT, CSV, TXT, and XML files. As it is not a standalone tool, it cannot be installed on its own. Instead, it is embedded into Java applications by including its library in the application's CLASSPATH.

JasperReports is a Java class library, and is not meant for the end users, but rather is targeted towards Java developers who need to add reporting capabilities to their applications.

Features of JasperReports

Some of the significant features of JasperReports are −

  • It has a flexible report layout.

  • It can present data either textually or graphically.

  • Developers can supply data in multiple ways.

  • It can accept data from the multiple data sources.

  • It can generate watermarks (A watermark is like a secondary image that is laid over the primary image).

  • It can generate sub reports.

  • It is capable of exporting reports in a variety of formats.

Advertisements