报表插件FineReport中如何设置自定义导出按钮

2025-04-17 18:20:17

1、报表嵌在iframe中如果是报表嵌在iframe中,在html页面可直接调用FR内部的导出方法,如导出PDF、导出Excel(分页)、导出Excel(原样)、导出Excel(分页分sheet)、导出Word等,界面效果如下:

报表插件FineReport中如何设置自定义导出按钮

2、需要添加的代码如下<button type="button" onclick="docume荏鱿胫协nt.getElementById('reportFrame').contentWindow.contentPane.exportReportToPDF()">导出[PDF]</button> <button type="button" onclick="document.getElementById('reportFrame').contentWindow.contentPane.exportReportToExcel('page')">导出[Excel](分页)</button><button type="button" onclick="document.getElementById('reportFrame').contentWindow.contentPane.exportReportToExcel('simple')">导出[Excel](原样)</button><button type="button" onclick="document.getElementById('reportFrame').contentWindow.contentPane.exportReportToExcel('sheet')">导出[Excel](分页分Sheet)</button><button type="button" onclick="document.getElementById('reportFrame').contentWindow.contentPane.exportReportToWord()">导出[Word]</button>

3、报表未嵌在i酆璁冻嘌frame中还有一种情况视报表没有嵌入在iframe中或者导出的报表与预览的报表不同,这时可以采用window.open()方法。这时可以将上述的button的onclick事件修改,代码为<button type="button" onclick="window.open(FR.cjkEncode('/WebReport/ReportServer?reportlet=doc/Primary/Parameter/parameter.cpt&地区=华东')+'&format=excel')">导出[Excel]</button>

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢