JasperReports Programming Guide 1.0
1 Introduction:
The JasperReport library is a flexible, powerful report generating tool that can generate reports in various forms such as PDF, HTML, or XML, and have a format report for CSV, XLS, RTF.
The engine is written by Java, supporting a variety of forms of application to generate dynamic reports such as J2EE, network reports, and more. Its main purpose is to generate page-oriented, which is convenient for printing report documents.
JasperReport is the data of the report in accordance with a predefined XML document, which is diverse, including relational database, Java container object (Collection and Arrays), and later we will introduce, users to implement data source and report engines through simple interfaces. usage of.
To complete the fill of the report, you must first complete the XML file for the report, the process is to first generate report design objects, sequentially, stored in a disk or network, to generate table data for specific applications. In fact, the design process of the form is to represent the design of the report with Java expressions defined in the XML file. There will be a variety of validation of data consistency during editing, eventually generating relevant data documents or preparations for filling data.
The report engine must first accept data (multiple forms such as parameters) to generate reports, more from the data source, the engine receives the data source object for filling the table, or processing the database by the JDBC connection object provided by itself. data.
The report eventually generates a new object to make a fill operation to generate a print document object, which is also a serialized object stored in a disk or network transmission medium. JasperReport's built-in browser can directly view the results or export in PDF, HTML, XML. 2, API overview
It is more important to use the part of the JasperReport class library instead of all to implement its characteristics and features. This section describes how to use these important classes and interfaces to implement the report functionality provided by JasperReport.
Class net.sf.jasperreports.Engine.Design.jaspeDesign
The reason why starting from this class is because its instance is the original class generated by JasperReport, for example, the class instance is parsed after the XML file used to generate the report, or does not generate an XML document but by calling JASPERREPORT The application is generated. One of the examples given is dynamically generated an example of the instance without generating an XML file. All instances of all such classes belong to the fillers of the report and generated before, so we call them the original class.
Class net.sf.jasperreports.Engine.design.jasperReport
This type of instance represents a report design object, is instantiated as a result of the compilation process of the report, and is preparation to populate the data in the report. In the compilation process of the report, the legality, consistency of the report element is synergistic; at the same time, all the variables, expressions are created in the temporary file storage report. During the compilation process, you will first find the Tools.jar or ANT in ClassPath, store the results in the form of bytecode, and is used to determine the form of a plurality of reports when populating data.
Class net.sf.jasperreports.Engine.design.jaspercompilemanager
This class allows users to compile XML from a file, stream, etc., allowing JasperDesign objects to be delivered directly and receives the corresponding JasperReport object, which is the entry class that compiles report design XML files as a report file that is waiting to be filled. Other Methods: Verify the legitimacy of the report, and construct an instance of the JasperDesign class is also useful, especially for visual editing editors.
Class net.sf.jasperreports.Engine.Design.jasperprint reports After the instance is generated, this object can be browsed by the JasperReport built-in report browsing tool, or serialized, send, etc. The instance of this class shows the report output of JasperReport; in addition to the format of the standard form, it can be converted to a variety of forms of PDF, HTML, XML, etc.
Class net.sf.jasperreports.Engine.Design.jrDataSource
In terms of report data, JasperReport is very flexible, providing a variety of data sources, with a corresponding programming interface for various data sources, and each report is filled, the engine instance of a particular scene will generate a specific scene.