表格软件FineReport中如何设置批量打印

 时间:2024-10-13 21:54:08

1、批量打印传入的url格式批量打印多张报表url格式如:http://localhost:8075/WebReport/ReportServer?reportlets=[{reportlet:'reportname1.cpt',paraname:'paravalue'},{reportlet:'reportname2.cpt',paraname:'paravalue'}]。调用内置的打印方法直接使用完整的url进行批量打印:var printurl="http://localhost:8075/WebReport/ReportServer?reportlets=[{reportlet:'reportname1.cpt',paraname:'paravalue'},{reportlet:'reportname2.cpt',paraname:'paravalue'}]";FR.doURLPDFPrint(printurl,true); //get方式传参

2、如批量打印的模板过多的话,url就很长,而get方式对长度有限制,url过长时会导致打印失败。推荐批量打印的时候用post菱诎逭幂方式,reportlets参数打包在数据包中传输,不在url中显示,从而缩短url长度,另外安全性较好,如下:var printurl="http://localhost:8075/WebReport/ReportServer"; var reportlets = FR.cjkEncode("[{reportlet: '/doc/Primary/Parameter/Parameter_1.cpt', 地区 : '华东'}, {reportlet: '/doc/Primary/Parameter/Parameter_1.cpt', 地区 : '华北'}]");var config = {url : printurl,isPopUp : false,data : {reportlets: reportlets}};FR.doURLPDFPrint(config);注:调用打印方法中的第二个参数为true表示弹出对话框,为false表示不弹出对话框即静默打印。

3、示例如需要打印出某个模板所有参数情况对应的结果,如下图,选择希望打印的参数值,点击doPrint按钮批量打印出对应的结果。

表格软件FineReport中如何设置批量打印

4、实现思路首先通过JS获取复选框的值然后拼凑出正确的url,最后调用打印方法如PDF打印,通过post方法传参(FR.doURLPDFPrint(printurl,true,{data: {reportlets : paravalue}});)或get方法传参(FR.doURLPDFPrint(printurl,true);)进行批量打印。

5、post传参PDF打印完整代码<html> <head> <title>FineReport 肛舀辨乔Demo</title> <script type="text/javascript" src="/WebReport/ReportServer?op=emb&resource=finereport.js"></script> <link rel="stylesheet" type="text/css" href="/WebReport/ReportServer?op=emb&resource=finereport.css"/> <script type="text/javascript"> function doPrint(){ //通过sessionid打印 var printurl="http://localhost:8075/WebReport/ReportServer"; var p=[];//获取当前页面选中的参数值,并将值放入数组中$(":checkbox").each(function(){if($(this).attr("checked")=="checked")p.push("{reportlet: '/doc/Primary/Parameter/Parameter_1.cpt', 地区 : " + $(this).val() + "}");})if(p.length>0){//将参数值组成的数组转化为字符串var rp=p.join(",");//使用FineReport自带的方法cjkEncode进行转码var reportlets=FR.cjkEncode("["+rp+"]"); var config = { url : printurl, isPopUp : false,data : { reportlets: reportlets } }; FR.doURLPDFPrint(config); }elsealert("请选择需要打印的参数"); } </script> </head> <body> <form name="report" width="200" height="200"> <input id="config1" type="checkbox" value="华东" />华东<br> <input id="config2" type="checkbox" value="华北" />华北<br> <input type="button" onClick="doPrint();" value="doPrint"><br> </form> <body> </html>

6、效果查看打开内置服务器,在浏览器中输入http://localhost:8075/WebReport/page_demo/cusprint_batch.html,选中多个复选框,点击doprint按钮,既可以实现批量打印了

  • Notepad++ 快速插入当前时间方法
  • weblogic启动 web应用ssh关闭 nohup命令
  • 如何使笔迹自己扩散并移动。
  • pacemaker中如何编写自定义OCF资源脚本?
  • vip域名有什么好处?
  • 热门搜索
    感恩手抄报内容大全 爱我家乡手抄报 科技知识手抄报 科学家的故事手抄报 我爱中华手抄报 白衣天使的手抄报图片 关于月球的手抄报 安全手抄报的图片 一二年级普通话手抄报 缅怀先烈的手抄报图片