Export html table to Excel javascript function special characters changed

后端 未结 5 1388
Happy的楠姐
Happy的楠姐 2021-01-01 02:22

I have the following function that exports an html to excel:

function generateexcel(tableid) {
  var table= document.getElementById(tableid);
  var html = ta         


        
5条回答
  •  误落风尘
    2021-01-01 02:59

    I have the same issue, just replace encodeURIComponent for escape.

    function generateexcel(tableid) {
     var table= document.getElementById(tableid);
     var html = table.outerHTML;
     window.open('data:application/vnd.ms-excel,' + escape(html));
    }
    

    It works for me...

提交回复
热议问题