LODOP和JS單元格自動(dòng)計(jì)算本頁合計(jì)值-判斷為0則顯示空
當(dāng)前位置:點(diǎn)晴教程→知識(shí)管理交流
→『 技術(shù)文檔交流 』
之前的博文有JS合計(jì)單元格和LODOP的合計(jì)單元格:JS設(shè)置table合計(jì)td的值、 <script language="javascript" src="LodopFuncs.js"></script> </head> <body> <div id="d1"> <table width="100%" border=1 style="border-collapse:collapse;"> <tr> <td id="td1">12</td> <td id="td2">10</td> </tr> <tr> <td id="td3">14</td> <td id="td4">1</td> </tr> <tr> <td>第二列的合計(jì)</td> <td id="s1" tdata="td2+td4">#</td> </tr> </table> </div> <a href="javascript:prn0_preview()">11打印預(yù)覽(兩個(gè)表格)</a><br> <script language="javascript" type="text/javascript"> var LODOP; //聲明為全局變量 function prn0_preview() { LODOP=getLodop(); LODOP.PRINT_INIT(""); LODOP.SET_PRINT_PAGESIZE(1,1000,1000,""); LODOP.ADD_PRINT_TABLE(0,0,"100%",90,document.getElementById("d1").innerHTML); var td2 = document.getElementById("td2").innerHTML; var td4= document.getElementById("td4").innerHTML; td2=Number(td2); td4=Number(td4); console.log("td2:"+td2+",數(shù)據(jù)類型是"+typeof(td2)); console.log("td4:"+td4+",數(shù)據(jù)類型是"+typeof(td4)); var s1=td2+td4; document.getElementById("s1").innerHTML=s1; LODOP.ADD_PRINT_TABLE(90,0,"100%",90,document.getElementById("d1").innerHTML); LODOP.PRINT_DESIGN(); }; </script> 圖示: 該文章在 2023/9/28 0:07:37 編輯過 |
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |