主题:[原创]报表批量打印代码分享
写了个方法,能批量打印报表,不用一个个报表点开再点打印按钮了。直接点一个按钮,就开始依次打印了。据说FineReport新版本里面会有可设置的方案,那就连代码也省的写了。
我的代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312"/>
<Script type="text/javascript" src="/WebReport/ReportServer?op=resource&resource=/com/fr/web/load.js"></Script>
</head>
<title>Print
</title>
<body>
<form name="finereport">
<input id="cpt" type="checkbox" value="/com/demo/basic/simplelist.cpt" />simplelist.cpt<br>
<input id="cpt" type="checkbox" value="/com/demo/basic/group.cpt" />group.cpt<br>
<input id="cpt" type="checkbox" value="/com/demo/basic/compair.cpt" />compair.cpt<br>
<input type=button name=print onclick=printURL() value="print"/>
<script language="javascript">
function printURL(){
var flag=0;
var url="http://localhost:8079/WebReport/ReportServer?reportlet=";
for (var i=0;i<document.report.cpt.length;i++ ){
if (flag==0)
{if(document.report.cpt.checked)
{url=url+document.report.cpt.value;
flag++;
continue;
}
}
if (flag!=0)
{if(document.report.cpt.checked)
{url=url+"&reportlet_"+flag+"="+document.report.cpt.value;
flag++;
}
}
}
javascript:print(url);
}
</script>
</form>
</body>
</html>
[url]http://www.finereport.com[/url]