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

 时间:2026-02-11 23:01:14

1、报表嵌在iframe中

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

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

2、需要添加的代码如下

<button type="button" onclick="document.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、报表未嵌在iframe中

还有一种情况视报表没有嵌入在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>  

  • 怎样解决Navicat链接数据库提示1130错误
  • oracle卸载和PLSQL Developer安装32位64位
  • 教你怎么使用mysql-gui-tools
  • oracle导入大量数据
  • 如何安装xmanager5
  • 热门搜索
    锅包肉的家常做法视频 飞蚊症的治疗方法 怎样做螃蟹简单又好吃 冲锋衣怎么清洗 清蒸鲤鱼的家常做法 现金流量表的编制方法 农村别墅设计图纸及效果图大全 水煮肉片的家常做法 对虾怎么做好吃 耳机线断了怎么接