Download IREPORT-0.4.0 (the structure of the graphical interface generated editing the structure)
Download ITextasian.jar (Asian language pack, if you have Asian characters in the generated report, you need to add this JAR in ClassPath)
Download JasperReports-0.6.1-Project.zip (include some examples of using JasperReports)
Run IREPORT / BIN / Startup.bat start IREPORT in Window
Common problem
1. Data Source: Usually we use JDBC to connect to databases or Custom Datasource
Custom DataSource is a way to organize data using user-defined data sources, which can be excel, csv and other files, or a class containing data (hereinafter referred to as data class).
2. Select the output form of the report under the Build menu, such as PDF Preview is output into a PDF file, JRVIEWER Preview is the preview feature in the IREPORT environment. Note that there is a difference in the effects in the IREPORT environment and the actual specific file display.
For Static Text and Field Text containing Chinese, modify font for the Chinese font in a system, PDF font name, select STSONG_LIGHT, select PDF Embeded PDF Encoding as unigb-ucs2-h (chinese simplified). And add ITEXTASIAN.JAR to the lib folder of IREPORT, so that Chinese is supported by the PDF file generated by Ireport.
3. The PDF file generated in the application system is not generated by Ireport. IREPORT is only used in editing and previewing reports, which generates * .jrxml files and generates * .jasper files after compiling. By calling JasperRunManager.RunReportTOPDFFILE (String Arg, Map Param, JRDataSource DataSource) in the program, the three parameters of this method represent the .jasper file location Arg, from the external parameter set param, and data classes .
4, the $ p {param_name} represents the name of the parameter, {} is the name of the parameter. After setting, after running, the title and other data are generated by the parameter introduced from the outside, and can be used as a query condition. SQL statement use (if you use JDBC directly to connect to the database)
$ V {page_number} Represents the current page, $ V represents Variable, for existing group, $ v {groupname_count} represents the number of records of the current group
The $ f {field_name} represents the field and is the most important part of the report. If the JDBC method is connected, enter the SQL query statement to get the fields obtained by all queries; if it is a Custom Datasource method, create a new field, such as user_id. GetfieldValue (JRFIELD FIELD) in the data class is the $ f {field_name} in the report. Which value returned according to the Name property of the JRField object in the program
IF ("User_ID" .Equals (Field.getName ())) Return Data [INDEX] [3]; // Representative Returns the fourth field of the current line
5, if an evaction Time error occurs, as long as you start from Properties> Text Field> Evaluation Time, select once again
6. About the data class. Data classes To implement JRDataSource interface, next, and getFieldValue methods. The functionality of NEXT is equivalent to a row, GetFieldValue's function is to get a field object from Jasper, and then pass the comparison of the string to obtain the corresponding data fill. If you want to see the effect in Ireport, you must have the method of obtaining this data class. The usual practice is to construct the XXXDataSourceFactory class to provide a method of returning a data class. This class does not need in actual applications
For example: getthedatasource () {return new xxxdataource ();
7, how to print the current time. Add a filed, text expression is New SimpleDateFormat ("YYYY.MM.DD"). Format (New Date ())
8, pay attention to check when the value is empty, displayed as blank