How I can build a custom button to use sheeljs to export in excel version 97-2004 xls file?
How I can build a custom button to use sheeljs to export in excel version 97-2004 xls file?
jmleitao
Posts: 6Questions: 2Answers: 0
I try to do this but doesn't work.
buttons:[
{
extend :'pageLength',
},
{
text: 'Exportar',
action: function ( e, dt, node, config ) {
//var elt = document.getElementById('DadosTab');
var wb = XLSX.utils.table_to_book(dt, {sheet:"Sheet JS"});
return dl ?
XLSX.write(wb, {bookType:type, bookSST:true, type: 'base64'}) :
XLSX.writeFile(wb, fn || ('test.' + (type || 'xlsx')));
}
}
],
This discussion has been closed.
Answers
You already had an answer to this.
https://datatables.net/forums/discussion/58437/excelhtml5-export-customize-function-doesnt-works#latest
This example shows how to create a custom button. The use of SheetJS is outside the scope of this forum. But you will likely need to use an ajax request to fetch the data to pass into SheetJS.
Kevin
ok, thanks to all, and i'm sorry, I don't see the answer from @colin.