WEB表格导出为EXCEL文档的方法

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 aloesky 的 blog

<script language="javascript">
function exportexcel(atbldata)
{
 if (typeof(export_object)!="object")
   {
     document.body.insertadjacenthtml("afterbegin","<object style='display:none' classid=clsid:0002e510-0000-0000-c000-000000000046 id=export_object></object>");
   }
 with (export_object){
          datatype = "htmldata";
          htmldata =atbldata.outerhtml;
      try{
           activesheet.export("c:\\sorttel.xls",0);
  alert('导出excel文档完毕');
          }
  catch (e)
  {
               alert('导出excel表失败,请确定已安装excel2000(或更高版本),并且没打开同名xls文件');
  }
            }
 }
</script>
<center><input type="button" value="导出以上数据为excel文档" onclick="exportexcel(tbldata)"></center>

本文关键:WEB表格导出为EXCEL文档的方法
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top