JasperReports Library - Samples

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.

Jasper Sample

This is the most complex sample provided with the package. It explains how to use data grouping and more complex element formatting.

FirstJasper.jrxml >> FirstJasper.pdf >> FirstJasper.html

Crosstab Sample

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.

ShipmentsReport.jrxml >> ShipmentsReport.pdf >> ShipmentsReport.html

Subreport Sample

Illustrates how subreports might be used in more complex reports.

MasterReport.jrxml >> MasterReport.pdf >> MasterReport.html

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.

DataSourceReport.jrxml >> DataSourceReport.pdf >> DataSourceReport.html

Fonts Sample

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.

FontsReport.jrxml >> FontsReport.pdf >> FontsReport.html

Horizontal Sample

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.

HorizontalReport.jrxml >> HorizontalReport.pdf >> HorizontalReport.html

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.

HyperlinkReport.jrxml >> HyperlinkReport.pdf >> HyperlinkReport.html

I18n Sample

The library has built-in support for generating documents in different languages.

I18nReport.jrxml >> I18nReport.pdf >> I18nReport.html

Images Sample

In this sample, users will learn how to use image elements in their reports.

ImagesReport.jrxml >> ImagesReport.pdf >> ImagesReport.html

JFreeChart Sample

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.

JFreeChartReport.jrxml >> JFreeChartReport.pdf >> JFreeChartReport.html

Scriptlet Sample

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.

ScriptletReport.jrxml >> ScriptletReport.pdf >> ScriptletReport.html

Shapes Sample

Shows how different graphic elements such as lines and rectangles can be used in the documents.

ShapesReport.jrxml >> ShapesReport.pdf >> ShapesReport.html

Stretch Sample

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.

StretchReport.jrxml >> StretchReport.pdf >> StretchReport.html

Styled Text Sample

The text elements can contain style information introduced using an XML syntax based on nested tags.

StyledTextReport.jrxml >> StyledTextReport.pdf >> StyledTextReport.html

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.

TableOfContentsReport.jrxml >> TableOfContentsReport.pdf >> TableOfContentsReport.html

Unicode Sample

JasperReports can generate documents in any language. This is a simple example that shows how font and text encoding settings should be used.

UnicodeReport.jrxml >> UnicodeReport.pdf >> UnicodeReport.html

Barbecue Sample

Sample that shows how to include barcodes inside reports using the Barbecue open source library.

BarbecueReport.jrxml >> BarbecueReport.pdf >> BarbecueReport.html

Landscape Sample

Shows how to set up a report in "Landscape" format.

LandscapeReport.jrxml >> LandscapeReport.pdf >> LandscapeReport.html

More Samples

JasperReports Server Samples

Jaspersoft Themes Samples