13.07.2015 Views

iReport Ultimate Guide - Nimsoft Library

iReport Ultimate Guide - Nimsoft Library

iReport Ultimate Guide - Nimsoft Library

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>iReport</strong> <strong>Ultimate</strong> <strong>Guide</strong>When we are finished, we save this template as an XML file sub-type that we call JRXML. Itcontains all the basic information about the report layout, including complex formulas to perform calculations, an optionalquery to retrieve data out of a data source, and other functionality we will discuss in detail in later chapters.A JRXML cannot be used as-is. For performance reasons, and for the benefit of the program that will run the report, <strong>iReport</strong>compiles the JRXML and saves it as an executable binary, a JASPER file. A JASPER file is the template that URuses to generate a report melding the template and the data retrieved from the data source. The result is a “meta print”—aninterim output report—that can then be exported in one or more formats, giving life to the final document.The life cycle can be divided into two distinct action sets:• Tasks executed during the development phase (design and planning of the report, and compilation of a UR file source,the JRXML).• Tasks that must be executed in run time (loading of the UR file, filling of the report, and export of the print in a finalformat).The main role of <strong>iReport</strong> in the cycle is to design a report and create an associated JASPER file, though it is able to previewthe result and export it in all the supported formats. <strong>iReport</strong> also provides support for a wide range of data sources and allowsthe user to test their own data sources, thereby becoming a complete environment for report development and testing.3.2 JRXML Sources and UR FilesAs already explained, UR defines a report with an XML file. In previous versions, XML syntax was defined witha DTD file (jasperreport.dtd). Starting with Version 3.0.1, JasperReports changed the definition method to allowfor support of user defined report elements. The set of tags was extended and the new XML documents must be validatedusing an XML-Schema document (jasperreport.xsd).Table 3-1A JRXML file is composed of a set of sections, some of them concerning the report’s physical characteristics, such as thedimension of the page, the positioning of the fields, and the height of the bands; and some of them concerning the logicalcharacteristics, such as the declaration of the parameters and variables, and the definition of a query for data selection.The syntax has grown more and more complicated with maturity. This is why many times a tool like<strong>iReport</strong> is indispensable.The following figure shows the source code of the report described in the previous chapter (Figure 2-19):. Code Example 3-1 A simple JRMXL file example32

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!