Lodop打印控件中眉腳項關聯(lián)各自表格,添加新眉腳項,注意關聯(lián)序號
當前位置:點晴教程→知識管理交流
→『 技術文檔交流 』
一個任務中有多個表格,根據(jù)每個表格設置自己的頁眉頁腳,這種時候可以使用眉腳項關聯(lián)表格。 <script language="javascript" src="LodopFuncs.js"></script> </head> <body> <div id="div1"> <table border=1 cellSpacing=0 cellPadding=1 width="100%" style="border-collapse:collapse;background-color:#ffcccc;text-align:center;"> <tr> <td colspan="2">表格的內(nèi)容</td> </tr> <tr> <td>單元格1</td> <td>單元格2</td> </tr> <tr> <td>單元格3</td> <td>單元格4</td> </tr> <tr> <td>單元格5</td> <td>單元格6</td> </tr> <tr> <td>單元格7</td> <td>單元格8</td> </tr> </table> </div> <div id="div2"> <table border=1 cellSpacing=0 cellPadding=1 width="100%" style="border-collapse:collapse;background-color:#ccffff;text-align:center;"> <tr> <td colspan="2">表格的內(nèi)容</td> </tr> <tr> <td>單元格1</td> <td>單元格2</td> </tr> <tr> <td>單元格3</td> <td>單元格4</td> </tr> <tr> <td>單元格5</td> <td>單元格6</td> </tr> <tr> <td>單元格7</td> <td>單元格8</td> </tr> </table> </div> <p><a href="javascript:prn1_preview()">自動分頁,兩個表格帶各自的頁眉頁腳</a></p> <p><a href="javascript:prn2_preview()">自動分頁,添加一個各自的條碼眉腳打印項</a></p> <script language="javascript" type="text/javascript"> var LODOP; //聲明為全局變量 function prn1_preview() {//根據(jù)超文本打印項高度47自動分頁 LODOP=getLodop(); LODOP.PRINT_INIT(""); LODOP.ADD_PRINT_TABLE(57,9,300,69,document.getElementById("div1").innerHTML); LODOP.ADD_PRINT_TEXT(16,62,197,20,"表格1的頁頭"); LODOP.SET_PRINT_STYLEA(0,"FontColor","#008000"); LODOP.SET_PRINT_STYLEA(0,"ItemType",1); LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1); LODOP.NewPageA(); LODOP.ADD_PRINT_TABLE(57,9,300,69,document.getElementById("div2").innerHTML); LODOP.ADD_PRINT_TEXT(16,62,197,20,"表格2的頁頭"); LODOP.SET_PRINT_STYLEA(0,"FontColor","#0000A0"); LODOP.SET_PRINT_STYLEA(0,"ItemType",1); LODOP.SET_PRINT_STYLEA(0,"LinkedItem",3); LODOP.PRINT_DESIGN(); }; function prn2_preview() {//沒有根據(jù)打印項高度47自動分頁 LODOP=getLodop(); LODOP.PRINT_INIT(""); LODOP.ADD_PRINT_TABLE(57,9,300,69,document.getElementById("div1").innerHTML); LODOP.ADD_PRINT_TEXT(16,62,197,20,"表格1的頁頭"); LODOP.SET_PRINT_STYLEA(0,"ItemType",1); LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1); LODOP.ADD_PRINT_BARCODE(14,273,110,35,"Code39","123456789");//增加新的頁眉頁腳項 LODOP.SET_PRINT_STYLEA(0,"ItemType",1); LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1); LODOP.NewPageA(); LODOP.ADD_PRINT_TABLE(57,9,300,69,document.getElementById("div2").innerHTML); LODOP.ADD_PRINT_TEXT(16,62,197,20,"表格2的頁頭"); LODOP.SET_PRINT_STYLEA(0,"ItemType",1); LODOP.SET_PRINT_STYLEA(0,"LinkedItem",4); //每個表格新加打印項后,后面表格關聯(lián)的序號增加了 LODOP.ADD_PRINT_BARCODE(14,273,110,35,"Code39","987654321");//增加新的頁眉頁腳項 LODOP.SET_PRINT_STYLEA(0,"ItemType",1); LODOP.SET_PRINT_STYLEA(0,"LinkedItem",4); //每個表格新加打印項后,后面表格關聯(lián)的序號增加了 LODOP.PRINT_DESIGN(); }; </script> </body> 圖示: 該文章在 2023/9/27 23:41:10 編輯過 |
關鍵字查詢
相關文章
正在查詢... |