标签:style blog class code java javascript ext color get string int
<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>";
把样式带进来
Lodop6 以上打印控件使用,详参考自带说明文档,打印样式及文字大小要特殊设置一下,码迷,mamicode.com
Lodop6 以上打印控件使用,详参考自带说明文档,打印样式及文字大小要特殊设置一下
标签:style blog class code java javascript ext color get string int
原文地址:http://www.cnblogs.com/tiger8000/p/3700941.html