tableExport.jquery.plugin icon indicating copy to clipboard operation
tableExport.jquery.plugin copied to clipboard

Export To Excel

Open woniel123mx opened this issue 11 years ago • 4 comments

Hi good evening, i make a change when export to excel, is better make a Blob object :)

var ext = "doc"; if(defaults.type == "excel"){ ext = ".xls"; }

var blob = new Blob([excelFile], { type: 'text/plain' }); var a = document.createElement('a'); a.href = window.URL.createObjectURL(blob); a.download = defaults.tableName + ext; a.click();

//window.open('data:application/vnd.ms-'+defaults.type+';filename=otro.doc;' + base64data);

woniel123mx avatar Feb 19 '15 01:02 woniel123mx

Can you please explain where you edited the code?

ngreis avatar Mar 15 '15 12:03 ngreis

@woniel123mx that doesn't seem to do anything on IE11...but it works in Chrome.

tafs7 avatar Apr 23 '15 23:04 tafs7

@woniel123mx also doesn't work in Firefox (latest). In fact neither the original solution (window.open) nor the Blob API solution above work in Firefox or IE11

tafs7 avatar Apr 24 '15 15:04 tafs7

I just use the following,rather than window.open:

    window.location.href = 'data:application/vnd.ms-'+defaults.type+';filename=otro.doc;'+base64data;

Appears to work well and doesn't pen up another window temporarily.

tmorehouse avatar Jun 21 '15 14:06 tmorehouse