报表生成器FineReport中如何设置自定义导出按钮

 时间:2026-02-15 20:24:32

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>  

  • 数据分析软件FineReport教程:[16]填报预览
  • 在VBA编程中怎样知道单元格的格式?
  • 报表中心FineReport中Java heap space错误问题
  • 在VBA中,编写代码使所选区域地址显示在状态栏
  • 报表组件FineReport中如何设置填报冻结
  • 热门搜索
    水痘的治疗方法 怎么共享别人的打印机 腌鱼的腌制方法 打印机墨盒怎么换 鱼汤怎么熬 珍爱网怎么样 饭店名字大全 骨质增生的治疗方法 中暑了怎么恢复的快 网站推广方法