//导出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(export1);
       sel.select();
       sel.execCommand("Copy");
       oSheet.Paste();
       oXL.Visible = true;
      }
     //导出Word
      function AllAreaWord()
      {
       var oWD = new ActiveXObject("Word.Application");
       var oDC = oWD.Documents.Add("",0,1);
       var oRange =oDC.Range(0,1);
       var sel = document.body.createTextRange();
       sel.moveToElementText(export1);
       sel.select();
       sel.execCommand("Copy");
       oRange.Paste();
       oWD.Application.Visible = true;
      }

注意:export1 是导出的DIV 的id ,如 <div automation服务器不能创建对象”

安全模式设置成“中”,如果javascript脚本中报这个错误,还应将IE的安全设置“不允许运行未标记为安全的activeX控件”启用即可。
注意如果您将相应的网站设成“受信任的站点”,必须对“受信任的站点”进行相应的IE安全设置,此时如果对“Internet”IE设置将是徒劳
的。

相关文章:

  • 2021-12-05
  • 2021-12-15
  • 2021-08-26
  • 2021-12-09
  • 2021-12-05
  • 2021-05-31
  • 2021-12-05
猜你喜欢
  • 2021-12-16
  • 2021-12-30
  • 2021-12-05
  • 2022-01-01
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案