• 表格导出EXCEL


    <TABLE   id="outtable"   name="outtable" border=1>  
      <TR>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      </TR>  
      <TR>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      </TR><TR>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      </TR><TR>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      </TR><TR>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      <TD>asdf</TD>  
      </TR>  
      </TABLE>  
    <input   type="button"   name="out_excel"   onclick="AutomateExcel();"

     

    <SCRIPT   LANGUAGE="javascript">
      function   AutomateExcel()
      {
      var   oXL   =   new   ActiveXObject("Excel.Application");
      var   oWB   =   oXL.Workbooks.Add();
      var   oSheet   =   oWB.ActiveSheet;
      var   hang   =   outtable.rows.length;

      var   lie   =   outtable.rows(0).cells.length;

      for   (i=0;i<hang;i++)
      {
      for   (j=0;j<lie;j++)
      {
      oSheet.Cells(i+1,j+1).value   =   outtable.rows(i).cells(j).innerText;
      }

      }
      oXL.Visible   =   true;
      oXL.UserControl   =   true;
      }
      </SCRIPT>

  • 相关阅读:
    无编译/无服务器,实现浏览器的 CommonJS 模块化
    程序员如何在工作中自我增值
    软件架构被高估,清晰简单的设计被低估
    为什么会产生微服务架构?
    版本管理Git和SVN的介绍及其优缺点
    13.递归第一次
    12.二叉树的序遍历
    12.二叉树的序遍历
    10.十进制转m进制
    10.十进制转m进制
  • 原文地址:https://www.cnblogs.com/zqmingok/p/1514141.html
Copyright © 2020-2023  润新知