How to display a report on a webpage (simple integration of a Web page and a report)
1. Problem Description
Currently, user-developed systems tend to be Browser/Server models in BS architecture. These systems may be developed in different languages, such as HTML, ASP, JSP, and PHP, therefore, you need to embed the prepared reports into these pages.
FineReport reports can be integrated into Web pages through the Frame framework.
2. display the report within the Frame
2.1Integration Method
As a part of the page, a report can be embedded in the webpage as iFrame, And the src of iFrame can be specified.
1. <iframe id = "reportFrame" width = "900" height = "400" src = "/WebReport/ReportServer? Reportlet =/doc/Primary/Parameter. cpt "> </iframe>
You can control the iframe location to control where the report is displayed on the page. You can also obtain the report through iframe to obtain the report content or call the existing methods in the report, we will introduce it in subsequent chapters.
Note: In this method, the src of iframe will display the complete report path. In particular, you can use the post method to submit a request to iframe with parameters, in this way, no specific parameters will appear in src.
2.2 example
We use HTML as an example to embed a report into an HTML page:
1. <! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN">
2.
3.
4. <title> FineReport Demo </title>
5. <meta http-equiv = "Content-Type" content = "text/html; charset = GBK"/>
6.
7. <body>
8. <iframe id = "reportFrame" width = "900" height = "400" src = "/WebReport/ReportServer? Reportlet =/doc/Primary/Parameter. cpt "> </iframe>
9. </body>
10.
2.3 view results
EnterHttp: // localhost: 8075/WebReport/page_demo/Simple.html, The effect is as follows:
For completed examples, see% FR_HOME % \ WebReport | page_demo \ Simple.html
3. reports cannot be displayed in div.
If you want the buttons on your system page to call the FineReport internal ready-made js methods such as (printing method), you need to load the FineReport js file. FR js uses the jquery v1.9.2 framework;
In actual situations, a page may not only contain the report part, but may load jquery of other versions. To avoid js conflicts, we recommend that you display the report content in iFrame, do Not Display it in the div.
When you need to call the js method inside FineReport, you can use iFrame to obtain the report and then call the method. For details, refer to the js instructions.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.