The format and extension of the "file.xls" file do not match

0

When I save a file from angularjs with a content and save it to an excel file. I get that message in excel and I can not find the solution because for more headers I add is still coming out, some indicate that it is by the kb link others that is for another kb and they indicate that modifque the registry and the configuration of the local excel, but if serving an excel file from my web as I solve this.

My code is such that:

 var header = '<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">';


        header+='<meta http-equiv="Content-Disposition" content="attachment; filename=contenido_excel.xls">';
        header+='<meta http-equiv="pragma" content="no-cache" />';
        header+='<meta http-equiv="expires" content="0" />';


        contenido_tabla = document.getElementById('contenido_excel').innerHTML;

        var contenido_muestra= contenido_tabla.replace(/Opciones/g,"");

        var blob = new Blob([header+contenido_muestra ], {

            type: "application/application/application/vnd.ms-excel;charset=utf-8"

        });
        saveAs(blob, "contenido_excel.xls");
    
asked by Rafael Lozano Ruiz 23.05.2017 в 15:02
source

0 answers