Background notes After the API reads the report template, it is easy to send the code to the corresponding document, such as the page presentation and export to Word, by operation. If the user wants the code after the operation, through the applet to print, this function how to implement it, how to add this Print button. Let's look at an example. Application examples Create a new JSP page with the following code: <%@ page contenttype= "text/html;charset=gb2312"%> <%@ page import= "java.io.*"%> <%@ page import= "com.runqian.report4.usermodel.*"%> <%@ page import= "com.runqian.report4.model.*"%> <%@ page import= "com.runqian.report4.view.html.*"%> <%@ page import= "com.runqian.report4.util.*"%> <%@ page import= "com.runqian.report4.view.excel.*"%> <% The first step is to read the report template InputStream Fis=application.getresourceasstream ("/reportfiles/test.raq"); Reportdefine rd = (reportdefine) reportutils.read (FIS); The second step, the Operation report Context context = new context (); Engine enging = new engine (rd, context); IReport IReport = Enging.calc (); Fourth step, show (show with pagination results) Htmlreport hreport = new Htmlreport (IReport, "Report1"); Out.print (hreport.generatehtml ()); %> <a href= "#" onclick= "Report1_print (); return false;" >print</a> <script language=javascript> function Report1_print () { Document.report1_printIFrame.location = "Http://192.168.0.132:8080/second/reportServlet?action=2&name= Report1&reportfilename=test.raq&srctype=file&saveprintsetup=no&appletjarname= Runqianreport4applet.jar&serverpagedprint=no "; } </script> <iframe name= "Report1_printiframe" id= "Report1_printiframe" src= "a.html" style= "position:absolute;left:-100px; top:-100px "Width=50 height=50></iframe> In this way, when the report is accessed, the page will come out with a print button and the applet can be printed by clicking on it. http://192.168.0.132:8080/second/reportservlet?action=2&name=report1&reportfilename=test.raq& Srctype=file&saveprintsetup=no&appletjarname=runqianreport4applet.jar&serverpagedprint= No this string should be modified according to the corresponding application. Http://192.168.0.132:8080/second: Is the ip+ port + application name; Name=report1 here with the new Htmlreport (IReport, "Report1"); Reportfilename=test.raq here to be the same as Application.getresourceasstream ("/reportfiles/test.raq") in the file name. |