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

          隨筆分類

          相冊(cè)

          報(bào)表工具廠商們

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

                 有一些客戶希望在一個(gè)頁(yè)面打開數(shù)據(jù)鉆取的全部?jī)?nèi)容,這個(gè)功能可以利用iframe在自定義瀏覽界面解決,下面以一個(gè)簡(jiǎn)單的例子來說明:

          1.         創(chuàng)建子模板son

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

          Java報(bào)表工具數(shù)據(jù)綁定 

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

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

           

          2.         創(chuàng)建主模板father     

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

          Java報(bào)表工具數(shù)據(jù)配置 

          2.2  右擊A2單元格,設(shè)置超級(jí)鏈接,增加網(wǎng)絡(luò)報(bào)表1,選擇網(wǎng)絡(luò)報(bào)表%FR_HOME%\WebReport\WEB-INF\reportlets\son.cpt。取消顯示在原有報(bào)表頁(yè)面的勾選,在網(wǎng)絡(luò)報(bào)表頁(yè)面顯示樣式右邊的空白輸入inner2,插入報(bào)表參數(shù)class的值為A2,如圖 

                      Java報(bào)表工具超鏈設(shè)置 

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

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

           

          3.         創(chuàng)建HTML文件iframe.html,源代碼如下:

          <html>

          <head>

          <title>自定義瀏覽頁(yè)面</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 + "頁(yè)/" + reportFrame.reportTotalPage +  "頁(yè)"; 

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

                 });

          }

          </script>

          </head>

           

          <body>

          <div id="toolbar" >    

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

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

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

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

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

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

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

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

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

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

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

          <button type="button" onclick="reportFrame.exportReportToPDF()">導(dǎo)出[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>表示把主模板鏈接的子模板顯示在一個(gè)iframe

           

          4.       預(yù)覽

          打開內(nèi)置服務(wù)器,在瀏覽界面輸入URL地址:

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

          Java報(bào)表工具預(yù)覽

           

          這樣,鏈接的報(bào)表直接出現(xiàn)在了被鏈接的報(bào)表下面

          文章轉(zhuǎn)自:http://blog.vsharing.com/fanfanzheng/A1385794.html



          了解Java報(bào)表工具就從這里開始
          posted on 2011-07-30 12:33 season 閱讀(589) 評(píng)論(0)  編輯  收藏 所屬分類: Java報(bào)表—技術(shù)知識(shí)
          主站蜘蛛池模板: 宝清县| 鹤峰县| 阜阳市| 岳阳市| 盐津县| 曲靖市| 长沙县| 密山市| 南昌市| 阜宁县| 开平市| 乳源| 晋宁县| 元朗区| 彩票| 来安县| 周宁县| 柳河县| 宿迁市| 海盐县| 蒙阴县| 濮阳市| 兰考县| 望奎县| 海门市| 澎湖县| 潜江市| 开鲁县| 祁阳县| 环江| 从化市| 包头市| 泊头市| 鲁山县| 安西县| 卫辉市| 苍梧县| 哈尔滨市| 德格县| 大化| 新闻|