Couple of Weeks back i started reading The Definitive Guide to JasperReports By Teodor Danciu , Lucian Chirita.
Nice book written by Teodor Danciu , Lucian Chirita.
I wanted to share few qoutations i found from this book found from the next 2 chapters (3-4).
1) The net.sf.jasperreports.engine.JasperFillManager class is usually used for filling a report template with data. This class has various methods that fill report templates located on disk, come from input streams, or are supplied directly as in-memory net.sf.jasperreports.engine.JasperReport objects.
2) The façade class net.sf.jasperreports.engine.JasperFillManager has a full set of methods that receive a net.sf.jasperreports.engine.JRDataSource object as the data source of the report that is to be filled.
3) JasperPrint objects can be serialized for storage or transfer over the network, viewed using a built-in viewer component, or printed or exported to more popular document formats like PDF, HTML, RTF, XLS, ODT, CSV, or XML.
4) Loading and Saving Generated Reports
Once a net.sf.jasperreports.engine.JasperPrint object has been created as a result of the report-filling process, you can serialize it and store it on disk, normally in a *.jrprint file. We could say that this is the proprietary format in which JasperReports stores its generated documents.
You can easily save and load JasperPrint objects to and from *.jrprint files or other byte streams using the net.sf.jasperreports.engine.util.JRSaver and net.sf.jasperreports. engine.util.JRLoader utility classes that the library offers. The JRLoader has various methods for loading serialized objects from files, URLs, input streams, or classpath resources. Its loadObjectFromLocation(String) method is the most flexible because it has a built-in fallback mechanism that tries to understand if the supplied java.lang.String location is a URL, file name, or classpath resource; only after all these fail will it raise an error.Sometimes it is more convenient to store generated documents in a text-based format like XML instead of serialized JasperPrint objects. This can be achieved by exporting those documents to XML using the net.sf.jasperreports.engine.export.JRXmlExporter implementation. The recommended file extension for these is *.jrpxml. The documents can be parsed back into in-memory JasperPrint objects using the net.sf.jasperreports.engine. xml.JRPrintXmlLoader utility class.
5) Here’s how you can print an entire document without displaying the standard print dialog:
JasperPrintManager.printReport(myReport, false);
6) Here’s how you can export your report to HTML format using the façade export manager class:
JasperExportManager.exportReportToHtmlFile(myReport);
About the Author
Teodor Danciu is the founder and architect of the JasperReports library, the most popular open source reporting tool, and is now working for JasperSoft. Before joining JasperSoft, Teodor worked for almost 8 years with several French IT companies as a software engineer and team leader on ERP and other medium-to-large database-related enterprise applications using mainly Java technologies and the J2EE platform. Teodor holds a B.S. in computer science from the Academy of Economic Studies in Bucharest.
Lucian Chirita joined Teodor Danciu at JasperSoft in the development of JasperReports library back in 2005, and he quickly became one of the main contributors to the project. Prior to joining JasperSoft, Lucian had 3 years of software engineering experience on several Java/J2EE products and applications. His contributions to JasperReports include support for crosstabs and integration with data query technologies such as Hibernate and OLAP. Lucian holds an M.S. in computer science from the University of Bucharest.
Monday, 24 November 2008
Subscribe to:
Post Comments (Atom)
1 comment:
JasperPrintManager.printReport(myReport, false);
Is it printing on Server or printing on calling machine.
If its on calling machine , how about the security , one can print malitious contents onto remote printer without the consent of the machine owner.
Post a Comment