Filesaver.js: Accents with weird caracters (Solved)

Created on 2 Dec 2015  路  2Comments  路  Source: eligrey/FileSaver.js

I use
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
the page is also UTF-8 but when I save the table it show weird caracters instead of accents also 帽 letter


Fixed with

Excel.$inject = [];
function Excel( ) {
   var header = '<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">';
   return {
      tableToBlob: function (tableId) {
         // REQUIRE FILESAVER 1.1 GITHUB
         var blob = new Blob([header + document.getElementById(tableId).innerHTML], {
            type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
         });
         saveAs(blob, "reporte.xls");
      }
   };
}

Most helpful comment

you must to use the next lines:

var header = '<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">';
var blob = new Blob([header + document.getElementById('table2excel').innerHTML], {
    type: "data:application/vnd.ms-excel;charset=UTF-8"});
saveAs(blob, nombreExcel+".xls");

All 2 comments

you must to use the next lines:

var header = '<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">';
var blob = new Blob([header + document.getElementById('table2excel').innerHTML], {
    type: "data:application/vnd.ms-excel;charset=UTF-8"});
saveAs(blob, nombreExcel+".xls");

Great! it was helpful for me! thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MFEKN picture MFEKN  路  5Comments

HeroSony picture HeroSony  路  5Comments

rhyous picture rhyous  路  6Comments

meenucoditas picture meenucoditas  路  6Comments

mluis picture mluis  路  3Comments