Build Generated Samples
For a current build generated reference of samples, click here.
JasperReports Library Samples
The JasperReports project tree containing the library source files and several demo applications that are easy to run and test using the Ant build tool. The project is available for download at SOURCEFORGE.NET.
The samples can be found in the demo/samples directory of the project. Some of them use data from the HSQL default database that is also supplied in the demo/hsqldb directory of the project.
Details about the structure of a JRXML report design and the use of different elements are available in the Schema Reference document. For each sample below, a *.Zip file is provided that includes the *.jrxml, *.pdf and *.html file.
For a quick review of the JasperReports library features, we present here some of those sample reports.
Table of Contents
This is the most complex sample provided with the package. It explains how to use data grouping and more complex element formatting.
Crosstabs are a special type of table component in which both the rows and the columns are dynamic. They are used to display aggregated data using tables with multiple levels of grouping for both columns and groups.
Illustrates how subreports might be used in more complex reports.
Data Source Sample
When generating reports, JasperReports can make use of various kinds of data, as long as the parent application provides a custom implementation of the net.sf.jasperreports.engine.JRDataSource interface that will allow it to retrieve that data. The library comes with a default implementation of this interface that wraps a java.sql.ResultSet object and lets people use JDBC data sources seamlessly.
Text formatting features are very important in document generating software and JasperReports offers a complete range of font settings: size, style, text alignment, color, etc.
The engine can fill multi-column reports either vertically (from top to bottom) or horizontally (from left to right), depending on the "printOrder" attribute specified in the report design. Here's a sample showing the detail section being generated horizontally.
This sample illustrates the use of hyperlink elements. They allow the creation of drill-down repots and generally speaking offer a higher degree of interaction with the document viewers.
The library has built-in support for generating documents in different languages.
In this sample, users will learn how to use image elements in their reports.
This sample shows how you can include graphics and charts into your reports. The JasperReports library does not produce graphics and charts itself, but allows the use of other specialized libraries and easily integrates this type of elements into the documents it generates.
Scriptlets are a very flexible feature of the JasperReports library and can be used in many situations to manipulate the report data during the report filling process.
Shows how different graphic elements such as lines and rectangles can be used in the documents.
This is a special sample with debug purposes. It shows how the text fields behave when they stretch downwards in order to acquire their entire content. Element stretching and page overflow mechanisms are very sensitive aspects of report generating tools.
Styled Text Sample
The text elements can contain style information introduced using an XML syntax based on nested
Table of Contents Sample
Some reports may require the creation of a "table of contents" structure, either at the beginning of the document or at the end. Here is a simple example for those who want to learn how to create such structures.
JasperReports can generate documents in any language. This is a simple example that shows how font and text encoding settings should be used.
Sample that shows how to include barcodes inside reports using the Barbecue open source library.
Shows how to set up a report in "Landscape" format.