1.Overview
The FineReport designer can make most reports without coding, but the requirements from clients can vary. Some personalized functions may not able to be realized by the designer. Users can modify the read template through programming, save it as a class web report, and then access the defined class web report on the Web side.
2.Class Web Report - cpt
2.1 Define Class Web Report
The corresponding class of class web report should inherit abstract class com.fr.web.core.Reportlet, implement the method createReport(ReportletRequest arg0) , and return the workbook. Users can read in existing template by specifying the path in the method. Example code here:
2.2 Compile the Class
Details omitted.
2.3 Save and Preview
Place the compiled class SimpleReportletDemo.class under webroot. Place the class under %FR_HOME%\webapps\webroot\WEB-INF\classes\com\fr\demo since the package is under com.fr.demo. Next, start up the server after saving.
For example, in the default web browser, enter http://localhost:8075/webroot/decision/view/report?viewlet=com.fr.demo.SimpleReportletDemo to view the illustration.
It just takes the same effect as \WEB-INF\reportlets\doc-EN\Primary\Parameter\Parameter_Reference.cpt
3. Class Web Report - frm
Example code here:
It works the same way as cpt. Here is what it looks like:
4.Remarks:
The example in this article reads in the existing templates in the report project. You could use your own template by modifying the path.
The class web report does not support hot reload. That is to modify the program and recompile, you need to restart the project to take effect. Otherwise, the original template is still displayed.