LODOP和JS单元格自动计算本页合计值-判断为0则显示空
当前位置:点晴教程→知识管理交流
→『 技术文档交流 』
之前的博文有JS合计单元格和LODOP的合计单元格:JS设置table合计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>第二列的合计</td> <td id="s1" tdata="td2+td4">#</td> </tr> </table> </div> <a href="javascript:prn0_preview()">11打印预览(两个表格)</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+",数据类型是"+typeof(td2)); console.log("td4:"+td4+",数据类型是"+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 编辑过 |
关键字查询
相关文章
正在查询... |