Authors: Teodor Danciu, Lucian Chirita
Pages: 236
Publisher: Apress
ISBN13: 9781590599273
The JasperReports library is a very powerful and flexible report-generating tool that delivers rich content to the screen, printer, or file in PDF, HTML, RTF, XLS, ODT, CSV, or XML format.
The library is written entirely in Java and can be used in a variety of Java-enabled appli-cations, including J2EE or web applications, to generate dynamic content. Its main purpose is to help to create page-oriented, ready-to-print documents in a simple and flexible manner.
JasperReports, like most reporting applications, uses report templates structured in mul-tiple sections, such as title, summary, detail, and page and group headers and footers. Each section has a free-form layout in which you can place various types of elements, including images, static and dynamic text fields, lines, and rectangles. The reporting engine uses this template to organize data in an XML file (JRXML) or to create it programmatically using the
library’s API. This data may come from various data sources, including relational databases,collections, or arrays of Java objects or XML data. Users can plug the reporting library into custom-made data sources by implementing a simple interface.
To fill a report with data, you must first compile the initial XML report template. Compila-tion validates the report template and attaches some compiler-related data to it. This data is used to evaluate the report expressions at runtime. The compiled report template can be seri-alized to store it on disk or sent over the network. This serialized object is then used when the application fills the specified report template with data. In fact, compiling a report template involves compiling all report expressions. Various verifications are made at compilation time to check report design consistency. The result is a ready-to-fill report template that is then used to generate documents on different sets of data.