如何将一个页面的多个表格导出到同一excel中
------解决方案--------------------
<table width= "100% " border= "1 " cellspacing= "0 " cellpadding= "0 " bgcolor = "#61FF13 ">
<TR style= "text-align : center; ">
<TD> 单元格A </TD>
<TD> 单元格A </TD>
<TD> 单元格A </TD>
<TD> 单元格A </TD>
</TR>
<TR>
<TD colSpan=4 style= "text-align : center; "> <font color= "BLUE " face= "Verdana "> 单元格合并行A </FONT> </TD>
</TR>
</TABLE>
<BR>
<table width= "100% " border= "1 " cellspacing= "0 " cellpadding= "0 ">
<TR style= "text-align : center; ">
<TD> 单元格B </TD>
<TD> 单元格B </TD>
<TD> 单元格B </TD>
<TD> 单元格B </TD>
</TR>
<TR>
<TD colSpan=4 style= "text-align : center; "> 单元格合并行B </TD>
</TR>
</TABLE>
<br> <br> <br>
<input type= "button " onclick= "javascript:AllAreaExcel(); " value= "导出页面内容到Excel ">
<SCRIPT LANGUAGE= "javascript ">
function AllAreaExcel()
{
var oXL = new ActiveXObject( "Excel.Application ");
var oWB = oXL.Workbooks.Add();
for(i = 0;i <document.getElementsByTagName( "TABLE ").length;i++)
{
oSheet = oWB.Worksheets.Add();
sel=document.body.createTextRange();
sel.moveToElementText(document.getElementsByTagName( "TABLE ")[i]);
sel.select();
sel.execCommand( "Copy ");
oSheet.Paste();
}
oXL.Visible = true;
}
</SCRIPT>
</body>
</html>
------解决方案--------------------
来错地方了吧O.o
------解决方案--------------------
哇,佩服ing
O.o
------解决方案--------------------
有在ff下的解决方法吗?
------解决方案--------------------
後台可以