87,907
社区成员
发帖
与我相关
我的任务
分享
var LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
function prn1_preview(Title, Lists, div2, biaoti,PageNumber) {//Lists 是gridview,Title是查询条件表的id,div2是gridvi外边套的div,biaot是报表的标题
LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
var PrintActionCode = "";
var tableStyleCode = "<style>table{border-collapse:collapse;border:solid 1px blue;}";
tableStyleCode += "table tr td{border:solid 1px blue;white-space:nowrap;word-break:normal;}";
tableStyleCode += "table tr th{border:solid 1px blue;white-space:nowrap;word-break:normal;} </style>";
LODOP.ADD_PRINT_TABLE(40, 210, 700, 1100, tableStyleCode + "<table width='100%' style=\"white-space:nowrap;word-break:normal; font-size='15';height:13%;\">" + $("#" + Title + "").children().html() + "</table>");
var j = 1;
LODOP.ADD_PRINT_TEXT(11, "40%", 417, 67, ""+biaoti+"");
// LODOP.ADD_PRINT_TEXT(100, 500, 417, 67, "第" + j + "页")
LODOP.SET_PRINT_STYLEA(0, "FontSize", 20);
PrintActionCode += "LODOP.ADD_PRINT_TABLE(\"95%\", \"90%\", 100, 100, \"<table><tr><td>第" + j + "页</td></tr></table>\");";
PrintActionCode += "LODOP.ADD_PRINT_TABLE(\"25%\", 40, 1050, 1200, \"" + tableStyleCode + "\"+\"<table width='100%'>\" +$(\"#" + Lists + " tr:eq(0)\").html() + pageAction(\"" + div2 + "\",0,20) + \"</table>\");";
for (var i = 20 ; i < $("#" + Lists + " tr").length; i += 25) {
PrintActionCode += "LODOP.NEWPAGE();";
j++;
PrintActionCode += "LODOP.ADD_PRINT_TABLE(\"95%\", \"90%\", 100, 100, \"<table><tr><td >第" + j + "页</td></tr></table>\");";
PrintActionCode += "LODOP.ADD_PRINT_TABLE(\"10%\", 40, 1050, 1200, \"" + tableStyleCode + "\"+\"<table width='100%'>\" + $(\"#" + Lists + " tr:eq(0)\").html()+ pageAction(\"" + div2 + "\"," + i + "," + (i + 25 ) + ") + \"</table>\");";
}
PrintActionCode += "LODOP.PREVIEW();";
eval(PrintActionCode);
};
function pageAction(div2, begin, end) {//封装的方法,js分页用,div2是gridview外边div的id
LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
var html = "";
$("#" + div2 + " tr:lt(" + end + "):gt(" + begin + ")").each(function(i) {
html += "<tr>" + $(this).html() + "</tr>";
});
return html;
}