web报表控件FineReport如何设置自定义批量导出

 时间:2026-02-14 22:34:31

1、原理

当您批量导出的报表中无参数时,可以将页面地址改为如下格式:

http://localhost:8075/WebReport/ReportServer?reportlets=({reportlet:/doc/Primary/CrossReport/Cross.cpt},{reportlet:/doc/Primary/DetailReport/Details.cpt})&format=XX

当您批量导出的报表中带有参数时,可使将页面地址改为如下格式:

http://localhost:8075/WebReport/ReportServer?reportlets=({reportlet:/doc/reportname.cpt,paraname1:paravalue1,paraname2:paravalue2,...},{reportlet:/doc/reportname.cpt,paraname1:paravalue1,paraname2:paravalue2,...},{...})&format=XX

注:format后面的XX,是指导出文件的格式,如果导出的是pdf,就写&format=pdf。其中{reportlet:/doc/reportname.cpt},是模板的访问路径;paraname1:paravalue1,是指导出各模板内容时,对应的参数名和参数值,多个参数中间用逗号隔开。

另:批量导出时导出的是一个文件,如果是excel,则会将多个报表导出在多个sheet中。

批量导出时,如果需要对导出的文件重命名,可以在url后面加上"&__filename__=name","name"就是自定义的文件名.

http://localhost:8075/WebReport/ReportServer?reportlets=({reportlet:/doc/reportname.cpt,paraname1:paravalue1})&__filename__=name

2、实现步骤

我们用一个按键来实现无参数导出成excel格式,只需要添加一个+'&format=excel按钮,将路径设置为上述格式,代码如下

<button type="button" onclick="window.open(FR.cjkEncode('/WebReport/ReportServer?reportlet=({reportlet:/doc/Primary/Parameter/Parameter.cpt,地区:华北},{reportlet:/doc/Primary/CrossReport/Cross.cpt})'+'&format=excel'))">导出[Excel]</button>  

上面的按钮的作用是导出地区参数为华北的Parameter.cpt和无参数Cross.cpt

注:自定义批量导出时,如果在导出的同时还在下载多个文件,推荐将浏览器的安全级别降低,避免被浏览器将导出文件判定为不安全文件。

  • web报表控件FineReport中js自定义按钮如何导出
  • 报表控件FineReport中如何设置自定义翻页按钮
  • 报表控件FineReport如何在权限中使用session
  • 报表控件FineReport中如何进行日志查看
  • 报表控件FineReport中Cnmoney函数介绍
  • 热门搜索
    亚洲最佳旅游地 跟团旅游注意事项 旅游活动策划书 青岛旅游景点图片 五台山旅游注意事项 旅游卡 吉林省旅游地图 新乡八里沟旅游攻略 新疆旅游局官网 苏州旅游公司