From d30678f0238a598a29bb4998f537826f22b47e6d Mon Sep 17 00:00:00 2001 From: Rener Lemes Date: Sun, 14 Feb 2016 10:22:17 -0200 Subject: [PATCH] Update tableExport.js Change the code to accept accents in XML Schema and export Word, Excel and Powerpoint with correctly name --- tableExport.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tableExport.js b/tableExport.js index 1bfaa0fc..257880c3 100644 --- a/tableExport.js +++ b/tableExport.js @@ -171,7 +171,7 @@ THE SOFTWARE.*/ window.open('data:application/json;filename=exportData;' + base64data); }else if(defaults.type == 'xml'){ - var xml = ''; + var xml = ''; //Accept accents (Example: João) xml += ''; // Header @@ -276,7 +276,11 @@ THE SOFTWARE.*/ excelFile += ""; var base64data = "base64," + $.base64.encode(excelFile); - window.open('data:application/vnd.ms-'+defaults.type+';filename=exportData.doc;' + base64data); + var anchor = document.createElement('a');//Create an anchor element + document.body.appendChild(anchor); //Add it to document + anchor.href = 'data:application/vnd.ms' + (defaults.type === 'doc' ? 'word' : '-' + defaults.type) + ';filename=exportData.doc;' + base64data; //Create content and mime type + anchor.download = 'exportData.' + (defaults.type === 'excel' ? 'xls' : (defaults.type === 'powerpoint' ? 'ppt' : defaults.type)); //Custom filename+ext (ext fix) + anchor.click();//Launch }else if(defaults.type == 'png'){ html2canvas($(el), {