隨筆 - 225  文章 - 98  trackbacks - 0
          <2011年7月>
          262728293012
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          隨筆分類

          相冊

          報表工具廠商們

          搜索

          •  

          最新評論

          閱讀排行榜

                 有一些客戶希望在一個頁面打開數據鉆取的全部內容,這個功能可以利用iframe在自定義瀏覽界面解決,下面以一個簡單的例子來說明:

          1.         創建子模板son

          1.1          打開Java報表工具設計器,新建工作簿,添加參數獲取數據集SELECT * FROM STSCORE where classno = '${class}',設置參數class默認值Class1,合并A1F12單元格,插入柱狀圖,綁定數據如下表:

          Java報表工具數據綁定 

          1.2          下一步去掉iframe里的工具欄:打開|報表Web屬性|分頁預覽設置,清空所有按鈕,取消頁面樣式

          1.3          保存模板到%FR_HOME%\WebReport\WEB-INF\reportlets\son.cpt

           

          2.         創建主模板father     

          2.1   新建工作簿,獲取數據集SELECT * FROM STSCORE,配置數據如下表:

          Java報表工具數據配置 

          2.2  右擊A2單元格,設置超級鏈接,增加網絡報表1,選擇網絡報表%FR_HOME%\WebReport\WEB-INF\reportlets\son.cpt。取消顯示在原有報表頁面的勾選,在網絡報表頁面顯示樣式右邊的空白輸入inner2,插入報表參數class的值為A2,如圖 

                      Java報表工具超鏈設置 

          2.3   去掉iframe里的工具欄,具體操作同子模板son

          2.4   稍作美觀,保存模板到%FR_HOME%\WebReport\WEB-INF\reportlets\father.cpt

           

          3.         創建HTML文件iframe.html,源代碼如下:

          <html>

          <head>

          <title>自定義瀏覽頁面</title>

          <meta http-equiv="Content-Type" content="text/html; charset=GBK">

          <script type="text/javascript" src="/WebReport/ReportServer?op=resource&resource=/com/fr/web/jquery.js"></script>

          <script type="text/javascript">

          window.onload = function(){

                 reportFrame = document.getElementById("reportFrame").contentWindow.contentPane;

                 reportFrame.on("afterload", function(){    

                      // currentPageIndex是從1開始的

                     var cPageIndex = reportFrame.currentPageIndex;   

                     var pv = "" + cPageIndex + "/" + reportFrame.reportTotalPage +  ""; 

                     $("#pnum").val(pv);

                 });

          }

          </script>

          </head>

           

          <body>

          <div id="toolbar" >    

          <button type="button" onclick="reportFrame.gotoFirstPage()">首頁</button>

          <button type="button" onclick="reportFrame.gotoPreviousPage()">上一頁</button>    

          <input id="pnum" type="text" readonly="true" style="width:80px"> 

          <button type="button" onclick="reportFrame.gotoNextPage()">下一頁</button>    

          <button type="button" onclick="reportFrame.gotoLastPage()">末頁</button>    

          <button type="button" onclick="reportFrame.pageSetup()">頁面設置</button>    

          <button type="button" onclick="reportFrame.pdfPrint()">客戶端PDF打印</button>

          <button type="button" onClick="reportFrame.flashPrint()">客戶端FLASH打印</button> 

          <button type="button" onclick="reportFrame.printReportServer()">服務器打印</button> 

          <button type="button" onClick="reportFrame.exportReportToExcel('page')">導出[Excel](分頁)</button>

          <button type="button" onClick="reportFrame.exportReportToWord()">導出[Word]</button>

          <button type="button" onclick="reportFrame.exportReportToPDF()">導出[PDF]</button>    

          <button type="button" onclick="reportFrame.emailReport()">郵件</button>  

          </div>

          <p align="center">

                 <iframe id="reportFrame" src="/WebReport/ReportServer?reportlet=father.cpt" frameborder="0"  width = "800" height = "128" ></iframe>

                 <iframe id="inner2" name="inner2" frameborder="0" width = "800" height = "300"></iframe>

                 </p>

          </body>

          </html>

          注意:其中代碼<iframe id="inner2" name="inner2" frameborder="0" width = "800" height = "300"></iframe>表示把主模板鏈接的子模板顯示在一個iframe

           

          4.       預覽

          打開內置服務器,在瀏覽界面輸入URL地址:

          http://localhost:8075/WebReport/iframe.html,效果如圖: 

          Java報表工具預覽

           

          這樣,鏈接的報表直接出現在了被鏈接的報表下面

          文章轉自:http://blog.vsharing.com/fanfanzheng/A1385794.html



          了解Java報表工具就從這里開始
          posted on 2011-07-30 12:33 season 閱讀(589) 評論(0)  編輯  收藏 所屬分類: Java報表—技術知識
          主站蜘蛛池模板: 新化县| 六枝特区| 大渡口区| 商城县| 务川| 玉田县| 海南省| 玉门市| 逊克县| 尼勒克县| 剑河县| 社会| 锡林郭勒盟| 无锡市| 平远县| 嵩明县| 文昌市| 贵德县| 冀州市| 成武县| 闽侯县| 济源市| 婺源县| 南川市| 亳州市| 万年县| 沭阳县| 墨脱县| 甘泉县| 泰州市| 南投市| 利津县| 本溪| 济阳县| 江华| 两当县| 夏津县| 会东县| 黎川县| 平远县| 隆林|