首页 > 代码库 > Lodop6 以上打印控件使用,详参考自带说明文档,打印样式及文字大小要特殊设置一下
Lodop6 以上打印控件使用,详参考自带说明文档,打印样式及文字大小要特殊设置一下
<link href="../css/cssprint.css" rel="stylesheet" /> <script src="../Lodop/LodopFuncs.js"></script> <style id="style1"> table { font-size: 9pt; font-weight: normal; color: #000000 ; text-decoration: none; } td { font-size: 9pt; font-weight: normal; color: #000000 ; text-decoration: none; } .printfont{ font-size: 9pt; font-weight: normal; color: #000000 ; text-decoration: none; } </style>
<script type="text/javascript"> var LODOP; //声明为全局变量 function PreviewMytable() { LODOP = getLodop(); LODOP.PRINT_INIT("预览打印表格"); LODOP.SET_PRINT_PAGESIZE(2, 0, 0, "A4"); LODOP.ADD_PRINT_TEXT(10, 410, 300, 30, "国 电 吉 林 热 电 厂") LODOP.SET_PRINT_STYLEA(0, "ItemType", 1); LODOP.SET_PRINT_STYLEA(0, "FontSize", 14); LODOP.SET_PRINT_STYLEA(0, "Bold", 1); LODOP.ADD_PRINT_TEXT(60, 20, 550, 50, "单位:<%=DropDownList1.SelectedItem.Text.ToString()%> (<%=numPerson%>人)") LODOP.SET_PRINT_STYLEA(0, "ItemType", 1); LODOP.SET_PRINT_STYLEA(0, "FontSize", 12); LODOP.SET_PRINT_STYLEA(0, "Bold", 1); LODOP.ADD_PRINT_TEXT(55, 370, 550, 50, "<%=DropDownList3.SelectedItem.Text.ToString()%> 年 <%=DropDownList4.SelectedItem.Text.ToString()%> 月 份 考 勤 记 录 簿") LODOP.SET_PRINT_STYLEA(0, "ItemType", 1); LODOP.SET_PRINT_STYLEA(0, "FontSize", 16); LODOP.SET_PRINT_STYLEA(0, "Bold", 1); LODOP.ADD_PRINT_TEXT(60, 800, 150, 30, "<%=DropDownList3.SelectedItem.Text.ToString()%>年 <%=DropDownList4.SelectedItem.Text.ToString()%>月<%=monthLastDay%>日") LODOP.SET_PRINT_STYLEA(0, "ItemType", 1); LODOP.SET_PRINT_STYLEA(0, "FontSize", 12); LODOP.SET_PRINT_STYLEA(0, "Bold", 1); LODOP.ADD_PRINT_TEXT(740, 80, 250, 30, "注:出勤“/”,串休“φ”。") LODOP.SET_PRINT_STYLEA(0, "ItemType", 1); LODOP.SET_PRINT_STYLEA(0, "FontSize", 10); LODOP.SET_PRINT_STYLEA(0, "Bold", 0); LODOP.ADD_PRINT_TEXT(740, 510, 120, 30, "单位领导:") LODOP.SET_PRINT_STYLEA(0, "ItemType", 1); LODOP.SET_PRINT_STYLEA(0, "FontSize", 10); LODOP.SET_PRINT_STYLEA(0, "Bold", 0); LODOP.ADD_PRINT_TEXT(740, 850, 120, 30, "考勤员:") LODOP.SET_PRINT_STYLEA(0, "ItemType", 1); LODOP.SET_PRINT_STYLEA(0, "FontSize", 10); LODOP.SET_PRINT_STYLEA(0, "Bold", 0); var strBodyStyle = "<style>" + document.getElementById("style1").innerHTML + "</style>"; var strFormHtml = strBodyStyle + "<body>" + document.getElementById("div1").innerHTML + "</body>"; LODOP.ADD_PRINT_TABLE(80, 15, "28cm", "17cm", strFormHtml); LODOP.SET_PRINT_STYLEA(0, "TableHeightScope",1); LODOP.PREVIEW(); }; </script>
关键这句
var strBodyStyle = "<style>" + document.getElementById("style1").innerHTML + "</style>"; var strFormHtml = strBodyStyle + "<body>" + document.getElementById("div1").innerHTML + "</body>";
把样式带进来
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。