我知道要设置单元格格式为文本但是用JS怎么设置?
我JS导出代码如下:
//指定页面区域内容导入Excel
function AllAreaExcel()
{
var oXL = new ActiveXObject("Excel.Application");
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var sel=document.body.createTextRange();
sel.moveToElementText(PrintA);
sel.select();
sel.execCommand("Copy");
oSheet.Paste();
oXL.Visible = true;
}
------解决方案--------------------------------------------------------
- HTML code
<html xmlns:v="urn:schemas-microsoft-com:vml"xmlns:o="urn:schemas-microsoft-com:office:office"xmlns:x="urn:schemas-microsoft-com:office:excel"xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"> </head><body link=blue vlink=purple><table cellpadding=0 cellspacing=0 border=0 width="100%"> <tr> <td align="left" class="Xtd1" style="">7</td> <td align="left" class="Xtd2" style="" x:str>CG0101 </td> <td align="left" class="Xtd2" style="" x:str>M </td> <td align="left" class="Xtd2" style="color:red" x:str>0000110029331(零还在)</td> <td align="left" class="Xtd2" style="" x:str>0000110029331</td> <td align="right" class="Xtd2" style="">1</td> <td align="right" class="Xtd2" style="">8.50</td> <td align="left" class="Xtd2" style="" x:str>OW00000888 </td> <td align="left" class="Xtd2" style="" x:str>洪記 </td> <td align="left" class="Xtd2" style="" x:str>NIL </td> <td align="left" class="Xtd2" style="" x:str>PRHK11090851 </td> <td align="left" class="Xtd2" style="" x:str>NIL </td> <td align="left" class="Xtd2" style="" x:str>China </td> </tr> <tr> <td align="left" class="Xtd1" style="">8</td> <td align="left" class="Xtd2" style="" x:str>CG0101 </td> <td align="left" class="Xtd2" style="" x:str>M </td> <td align="left" class="Xtd2" style="color:red" x:str>0000256</td> <td align="left" class="Xtd2" style="" x:str>CONN-TEK(仲駿) </td> <td align="right" class="Xtd2" style="">3</td> <td align="right" class="Xtd2" style="">13.30</td> <td align="left" class="Xtd2" style="" x:str>0084771754 </td> <td align="left" class="Xtd2" style="" x:str>洪記 </td> <td align="left" class="Xtd2" style="" x:str>NIL </td> <td align="left" class="Xtd2" style="" x:str>PRHK11090778 </td> <td align="left" class="Xtd2" style="" x:str>NIL </td> <td align="left" class="Xtd2" style="" x:str>China </td> </tr> </table></body></html>