FineReport 发表于 2011-7-30 14:09:32

报表制作工具数据钻取在一个页面展开

       有一些客户希望在一个页面打开数据钻取的全部内容,这个功能可以利用iframe在自定义浏览界面解决,下面以一个简单的例子来说明:1.
创建子模板son1.1
打开报表制作工具设计器,新建工作簿,添加参数获取数据集SELECT * FROM STSCORE where classno = '${class}',设置参数class默认值Class1,合并A1至F12单元格,插入柱状图,绑定数据如下表:http://www.finereport.com/forumimages/get_data_same_page1.jpg 1.2
下一步去掉iframe里的工具栏:打开报表|报表Web属性|分页预览设置,清空所有按钮,取消页面样式1.3
保存模板到%FR_HOME%\WebReport\WEB-INF\reportlets\son.cpt 2.
创建主模板father
2.1
新建工作簿,获取数据集SELECT * FROM STSCORE,配置数据如下表:http://www.finereport.com/forumimages/get_data_same_page2.jpg 2.2
右击A2单元格,设置超级链接,增加网络报表1,选择网络报表%FR_HOME%\WebReport\WEB-INF\reportlets\son.cpt。取消显示在原有报表页面的勾选,在网络报表页面显示样式右边的空白输入inner2,插入报表参数class的值为A2,如图http://www.finereport.com/forumimages/get_data_same_page3.jpg2.3
去掉iframe里的工具栏,具体操作同子模板son2.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">首页</button><button type="button">上一页</button>
<input id="pnum" type="text" readonly="true" style="width:80px">
<button type="button">下一页</button>
<button type="button">末页</button>
<button type="button">页面设置</button>
<button type="button">客户端PDF打印</button> <button type="button">客户端FLASH打印</button>
<button type="button">服务器打印</button>
<button type="button">导出(分页)</button> <button type="button">导出</button> <button type="button">导出</button>
<button type="button">邮件</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,效果如图:http://www.finereport.com/forumimages/get_data_same_page4.jpg这样,链接的报表直接出现在了被链接的报表下面文章转自:http://blog.vsharing.com/fanfanzheng/A1385794.html
页: [1]
查看完整版本: 报表制作工具数据钻取在一个页面展开