一、tableExport.js對中文的支持很差,經常出現亂碼,去修改代碼比較繁瑣。css
二、用clipBoard.js代替html
bootCDN地址: https://cdn.bootcss.com/clipboard.js/2.0.1/clipboard.min.jsjquery
用法:cdn
html:htm
<button class="btn btn-success" id="copy" data-clipboard-target="#table">複製到剪切板</button> //複製按鈕ip
<table class= "table table-bordered table-condensed table-hover" id="table"> //被拷貝的表格文檔
jquery:get
var clipboard = new ClipboardJS('#copy');io
clipboard.on('success', function(e) {table
alert("已複製,請粘貼到EXCEL文檔中");
e.clearSelection();
});
clipboard.on('error', function(e) {
alert("複製失敗");
});
三、最後再粘貼到EXCEL表裏,至今未發現亂碼
總結:
1)該方法缺點是步驟多了一點
2)該方法優勢:
21)避免了亂碼
22)雖然步驟多一步,但比較符合用戶操做習慣