excel报表工具FineReport之参数界面及工具栏

 时间:2024-10-22 09:43:01

FineReport本身自带多种可编辑控件,可以实现复杂参数界面的制作。但是有时为了实现与系统界面中控件的一致性,希望不使用FR内置的参数界面和内置工具栏,而是自己定义参数界面以及工具栏,此时要如何设置呢?

工具/原料

excel报表工具FineReport

1.解决思路

1、在自定义参数界面中介绍了自定义参数界面的实现方式,在自定义工具栏章节中介绍了各种按钮的实现方式,那么只需要将这两个实现过程结合起来即可。

2.示例

1、以自定义参数界面中的最终模板/demo/parameter/number1.cpt模板为例,将其嵌入到页面中去,并且不显示模板参数界面和内置工具栏。

2、1效果效果如下图所示

excel报表工具FineReport之参数界面及工具栏

3、输入最小库存量,点击查询,就会提交参数值给number1.cpt模板,并且在该页面显示过滤结果。

4、2网页设计网页设计参见自定义参数界面并传参,只需要再添加一个工具栏即可,工具栏添加的详细介绍请查看自定义工具栏按钮。在网页中添加如下代码:

5、<body><!--自定义工具栏--><divi蟠校盯昂d="toolbar"><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.gotoFirstPage()">首页</button><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.gotoPreviousPage()">上一页</button><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.gotoNextPage()">下一页</button><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.gotoLastPage()">末页</button><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.flashPrint()">客户端FLASH打印</button><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.exportReportToExcel('page')">导出[Excel](分页)</button><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.exportReportToWord()">导出[Word]</button></div>

6、完整代码如下:<html><head><title>FineReportDemo</title><metahttp-equiv="Content-Type"content="text/html;charset=GBK"/><scripttype="text/javascript">//cjkEncode方法的实现代码,放在网页head中或者用户自己的js文件中functioncjkEncode(text){if(text==null){return"";}varnewText="";for(vari=0;i<text.length;i++){varcode=text.charCodeAt(i);if(code>=128||code==91||code==93){//91is"[",93is"]".newText+="["+code.toString(16)+"]";}else{newText+=text.charAt(i);}}returnnewText;}functionautoSubmit(){varnum=document.getElementById('num').value;//获取文本控件的值varrow=document.getElementById('row').value;//获取下拉框控件的值//拼接出最终报表访问路径,并对完整的路径进行编码转换,防止乱码问题varreportURL=cjkEncode("/WebReport/ReportServer?reportlet=/demo/parameter/number1.cpt¶="+num+"&row="+row);document.paraForm.action=reportURL;//通过form的name获取表单,并将报表访问路径赋给表单的actiondocument.paraForm.submit();//触发表单提交事件}</script></head><body><fieldset><legend>查询表单:</legend><formname="paraForm"method="post"target="reportFrame">最小库存量:<inputtype="text"name="num"id="num"value="1"/>每页显示行数:<selectname="row"id="row"><optionvalue="10"select>10<optionvalue="20">20<optionvalue="30">30<inputtype="button"name="show"value="查询"onclick="autoSubmit()"/></form><!--自定义工具栏--><divid="toolbar"><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.gotoFirstPage()">首页</button><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.gotoPreviousPage()">上一页</button><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.gotoNextPage()">下一页</button><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.gotoLastPage()">末页</button><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.flashPrint()">客户端FLASH打印</button><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.exportReportToExcel('page')">导出[Excel](分页)</button><buttontype="button"onclick="document.getElementById('reportFrame').contentWindow.contentPane.exportReportToWord()">导出[Word]</button></div></fieldset><iframeid="reportFrame"name="reportFrame"width="100%"height="100%"></iframe></body></html>

7、已完成页面请参照%FR_HOME%\WebReport\page_demo\parameter_toolbar.html.

  • 如何使用FineReport报表工具设置填报选中行背景
  • 数据展示教程之FineReport工具:判断是否为空
  • 数据报表FineReport中如何实现分级权限分配
  • PLSQL Developer怎么设置允许编辑数据源
  • 自定义报表系统FineReport设计器中的导出
  • 热门搜索
    我爱文学的手抄报 我爱文学手抄报图片 简单的手抄报 快乐的暑假手抄报 洒扫应对手抄报 校园手抄报内容 大自然的启示手抄报 二年级绿色环保手抄报 安全伴我行手抄报内容 我爱读书手抄报资料