Excel export button: how to setup differing / multiple "exportOptions" for individual columns?
Excel export button: how to setup differing / multiple "exportOptions" for individual columns?
(.net)
button excelHtml5 export:
Question:
I need to modify export data of columns let's say A B C and columns D E F differently, and it can't be done in one go.
Therefore in export options I need to parse and substitute data column by column!
I would need to define something like this:
buttons: [{
extend: 'excelHtml5',
messageTop: 'your exported excel data looks like...',
exportOptions: {
{
columns: [1, 2],
stripHtml: true,
format: {
body: function (data) {
data = data.replace(/[K]/g, 'O');
return data;
}}
},
{
columns: [3, 4],
stripHtml: true,
format: {
body: function (data) {
data = data.replace(/[O]/g, 'K');
return data;
}}
}
},
Above obviously doesn't work, just for explanation...
Is sequentially modifying data somehow possible at all here?
Thanks in advance !
Replies
ok, I answer my own questions now.
should have tested this earlier.
so here's how to modify & export data to excel, column by column, before export: