excel


 
 

<table name="list" id="list" >
  <tr><td>1</td><td>2</td></tr>
<tr><td>12</td><td>42</td></tr>
<tr><td>12</td><td>25</td></tr>
<tr><td>13</td><td>26</td></tr> 
 
</table>
   <script language=javascript>
 
 function exportToExcel()
  {
  var out =document.getElementById("list");//这是table的id
  window.clipboardData.setData("Text", out.outerHTML);
  var oXL = new ActiveXObject("Excel.Application");
  try
  {
      // Get a new workbook.
      oXL.Visible = true;
      var oWB = oXL.Workbooks.Add();
      var oSheet = oWB.ActiveSheet;
      oSheet.Paste;
  }catch(e)
  {
   oXL.Quit();
   oXL = null;
  }
  }
exportToExcel() ;
</script>

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页