angular 导出excel

http://www.cnblogs.com/gzhlt/p/5274702.html

引用 2 楼 u012129566 的回复:
Quote: 引用 1 楼 loveshrimp423 的回复:
 小子,你运气好,我刚做过,找了很久才找到个能用的。

<SCRIPT LANGUAGE="javascript">

<!--

    function AutomateExcel() {

        var elTable = document.getElementById("table1"); //table1改成你的tableID

        var oRangeRef = document.body.createTextRange();

        oRangeRef.moveToElementText(elTable);

        oRangeRef.execCommand("Copy");

        try {
            var appExcel = new ActiveXObject("Excel.Application");
        } catch (e) {
            alert("无法调用Office对象,请确保您的机器已安装了Office并已将本系统的站点名加入到IE的信任站点列表中!");
            return;
        }

        appExcel.Visible = true;

        appExcel.Workbooks.Add().Worksheets.Item(1).Paste();

        appExcel = null;

    }

//-->

</SCRIPT>


调用

 <input type="button" name="out_excel" onClick="AutomateExcel();" value="导出到excel" class="notPrint"> 
      

还是没反应啊大哥,稍微细点再,会不会跟引用有关


用IE,360的话要用兼容模式,可以的

原文地址:https://www.cnblogs.com/lacey/p/5611371.html