Detailed
ireport and Jasperreport Development detailed 11, Brief introduction: jasperreport is a report making tool, The user is required to write an XML according to the rules it writes, and then get the report file that the user wants. Jasperreport Library is a flexible, powerful report generation tool that can generate reports in a variety of formats, such as PDF, HTML, or XML, and support CSV, XLS, and other format reports. The engine is written by Java and supports multiple forms of application generating dynamic reports. A printed report document that organizes the report's data according to a predefined XML document, including relational databases, Java container objects, which we'll cover with a simple interface for using the data source and report engine Jasperreport. first of all we use the IReport version is: "IReport 0.4.1"; The Jasperreport version is: "JasperReports 0.6.5". The current ireport support Asperreports 0.6.0 to 0.6.4 versions include 0.6.0. and 0.6.4 itself. 1. Operating Environment JDK requires a minimum 1.2.2 or higher version. 2.Jasperreport mode of work (Photo source: http://ireport.sourceforge.net/cap3.html#3.1) after the user has designed the report by using ireport, they get an XML file (end of. Jrxml), compile and build Jasper file (ending with. Jasper), and ultimately use the compiled *.jasper file 3. ireport 3.1.1 will IReport0.4.1 after decompression in the directory will have a named: "Ireport.bat" Batch file, Double-click to run it (figure:). 3.1.2 ireport run upAfter the main interface as follows: 3.1.3 production of a report based on SQL Server database (static report produced a lot on the web, not described here), Select the File menu (Figure 1) to create a new report (You can also select the Reports Wizard Report Wizard to generate the report, now don't talk about it), or click on the icon to make a new report. 3.1.4 True Write report properties in " Report Name "real name," in the "Page size" area to select the paper and size you want to use, we choose the default parameters here, a lot of information on the Internet need to modify the "i18n" tab in the "XML Encoding", Change to "GB2312", the default parameter is "UTF-8" and ireport did not provide this option, and this option we did not modify it is still "UTF-8", if you think it is necessary to manually enter "GB2312". then click OK. The main interface becomes: 3.1.5 set the data source, click the menu "DataSource", select "Connections/datasources" to show the following frame, click "New" to set the data source Click "New", pop up the frame, set the connection properties (figure:), select your data source ("Type of connection/ Ddatasource "), which has JAVABEAN,XML,JDBC and other data sources, we choose the JDBC data source, the data source name" name ", you can enter any name you like. Select the database connection driver in the JDBC Driver drop-down list box, and we choose to connect to the URL of the SQL Server class, which is connected to JDBC, which will be automatically filled in for you. In the server address input box, enter the location. In the Database input box, fill in the name of the databases you want to use. and fill in your login database username "UserName" and password "Password", then click the passwordThe "Save Password" on the edge of the input box to save the password, and then click "Wizard" to update your login to the "JDBC URL", now we should make a connection test to the database to see if the settings are correct Click "Test" in the lower-right corner, and if the test succeeds, it pops up or it pops up the Connection error dialog box ( At this point you have to check if your settings are correct, so that you have a safe landing method for the database. To be continued faq 1. Generate a report garbled in Chinese? Jasperreport's Chinese processing requires an Asian language pack. Itextasian.jar, "to the Lib directory under ireport, and then modify the report's PDF Font Name to" Stsong-light ", and then modify PDF Embedded PDF Encoding To change it to" Unigb-ucs2-h (Chinese Simplified) ", so that you can solve the problem of Jasperreport Chinese (for the PDF set, for Excel may be less, but this setting also can be displayed as Chinese, is not like to lead the ring). 2. noclassdeffoundexception exceptions are generated when the report is compiled? This exception occurs when code handles jasperreport because some jar files that refer to Jasperreport are incomplete. Due to work busy my way is to Jasperreport directory of the demo ample\webapp\web-inf\lib\ all the jar files, all cited, safekeeping, but also no time to too much to delve into. There will be some unnecessary packages that are quoted if you have time toTake a look, and then remove the unnecessary jars. 3. Unisupportencodingexception exception occurred while saving as PDF? in the report design process will inevitably have a small error, this is because the "PDF Font Name" should be changed to " Stsong-light ". download Related: ireport download address: http:// Ireport.sourceforge.net jasperreport Download Address: http:// Jasperreports.sourceforge.net itext Asian language Pack download address: http:// Www.lowagie.com/iText
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.