Can the Excel button export display and data both?

Can the Excel button export display and data both?

az1az1 Posts: 14Questions: 7Answers: 1

Hi

All of my columns are exporting the data displayed except one, because I render an image for that column if the data is true - I have a render function set up for this. So the excel output is currently blank for this column.

After reading the help page (https://datatables.net/reference/api/buttons.exportData()), it looks like the default behaviour is to export the display (orthogonal), however for this particular column I would like to output the data behind the column.

I am already specifying a set of columns to output (as I do not want to export hidden columns).
Q. Is it possible to export both display and data?
So one column would be from the data, the rest would be from the display?
This is the configuration I currently have to output all the visible columns:

$('#dataTable').dataTable({
"dom":"<ZBf<t>Rlp>",
"buttons":[{
"extend":"excel",
"className":"btn btn-primary dataTableCustomBtn m-r-5",
"filename":"Meter List",
"sheetName":"Meter List",
"exportOptions":{
"columns":[1,2,3,4,6,7,17]},
"title":null
}]
}]

Any help much appreciated.

thanks
Az

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @az1 ,

    This thread should help, it's asking the same thing.

    Cheers,

    Colin

  • az1az1 Posts: 14Questions: 7Answers: 1

    Hi

    Thanks for the info.

    I've tried using:

    exportOptions: {
    stripHtml: false
    }

    but in the excel output I get the html for the icon:

    <i class='fa fa-check fa-2x' aria-hidden='true' title=''></i>

    Do I need any other setting?

    thanks
    Az

This discussion has been closed.