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

 时间:2026-04-23 20:01:09

1、报表嵌在iframe中

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

excel报表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>  

  • excel的msgbox
  • EXCEL中VBA实例技巧:[1]单元格字体格式设置
  • EXCEL自启动宏设置
  • Excel快速提取数值
  • EXCEL中如何隔列显示颜色
  • 热门搜索
    西瓜英语怎么读 抑郁症怎么办 在周末用英语怎么说 黑眼圈怎么样消除 飞机票怎么买 合生元益生菌怎么样 我的世界天堂门怎么做 小鲫鱼怎么做好吃 空心菜怎么炒 谷歌账号怎么注册