Encoding UTF-8 when exporting HTML table to Excel

前端 未结 5 945
感动是毒
感动是毒 2020-12-01 09:39

I am trying to export an HTML table to Excel using javascript. This is the javascript code



        
5条回答
  •  渐次进展
    2020-12-01 10:37

    function exportData(report_id){
        var blob = new Blob([document.getElementById(report_id).innerHTML], {
            type: "text/plain;charset=utf-8;"
        });
        saveAs(blob, "Report.xls");
    }
    

    Takes table data as plain text and save as Excel without encoding problem

提交回复
热议问题