We usually print the report may encounter a lot of problems, such as to create a template through an XML data source, rather than separate through the database SQL statements to export data, such as to achieve silent printing, preview printing, and batch printing, or want to choose a different page, the system according to their own choice, Choose a different template for printing after clicking Print, and so on. Maybe 1:30 will not be solved, today I would like to share some of the problem of printing reports solution.
Report Development Requirements Description System requirements
1, has developed a good report template: For users to print and browse;
2, did not develop the report template: Can let the user self-Development Report template, and upload saved to the server for subsequent printing and browsing.
Specific requirements List
1, the user can make the template through the XML data source, rather than the individual through the database SQL statement to export data;
2, printing system and reporting system to achieve single sign-on, so that users in the system switching process, no need to log in directly to print;
3, the warehouse report template stored in different directories, convenient follow-up management;
4, can achieve silent printing, preview printing, and batch printing, etc.;
5, the user chooses the different page, the system may according to the user's choice, after the click Prints selects the different template to print;
6, template permissions control, users can only preview and print permissions within the template, for other templates, there is no permission to preview and print operations.
Tools
Report development tool: FineReport
Finereport is a Java Report development tool that integrates data presentation (reporting) and data entry (form) to quickly build an enterprise information system.
Report Development Scenario Overview report development process Design
1, the business personnel use the empty data the XML data source to produce the report;
2, upload the report to the server;
3, the user selects the print module arrow;
4, through the dynamic generation of XML, print out a template with data.
Business people making reports
1, the data field is obtained by loading the XML data source of the empty data;
2, drag data, make templates;
3, will make a good template, through the development of the upload page, the template classification to save to different directories (Finereport can not be directly completed, the need to write their own upload).
Business people Print
1, the business staff in the developed Good page, select the module to be printed;
2, select the report to be printed;
3. Generate XML with data in the background, and push it to the report template (with accept parameter interface);
4, Direct printing (silent printing), or print preview (with print interface).
XML Format requirements
The generated XML must be a two-dimensional table structure data
650) this.width=650; "src=" http://img.blog.csdn.net/20150902102513998 "alt=" 20150902102513998 "/>
XML Data Source Conversions
When the user makes the report, it uses the XML of the empty data, but when printing, it is necessary to connect the XML with the data in real time. Through the XML file name, the dynamic transformation is realized by the Parameter form.
650) this.width=650; "src=" http://img.blog.csdn.net/20150902102524375 "alt=" 20150902102524375 "/>
Bulk Print Interface Calls
You can call the template printing function in bulk by GET or post directly, as follows function
650) this.width=650; "src=" http://img.blog.csdn.net/20150902102529548 "alt=" 20150902102529548 "/>
Report Printing problem Overall solution