Line Breaks not happening in the cells when using Export to Excel Button in Datatables
Line Breaks not happening in the cells when using Export to Excel Button in Datatables
Hi,
I'm using render columns option in the columns to show the data with Line breaks in one of the columns in the grid.
But when i use the Export to Excel button functionality, all data is being populated in one line on the cell in the excel sheet even thought orthogonal in export options is default as display.
This is the code in datatable initialisation
buttons: [
{
extend: 'excel', text: 'Export to Excel', filename: 'Data export', exportOptions: {
orthogonal: {
display: ':null'
}
}
}],
"columns": [
{
"data": null,
"defaultContent": "<button id >Add</button>",
},
{ "data": "company", "autoWidth": true },
{
"data": "notes", "autoWidth": true,
"render": function (data, type, row) {
return data.split(", ").join("<br>");
console.log(data);
}
I have attached the images related to the grid and excel.
I'm not sure what i'm missing here. Any help would be appreciated.
Thanks,
Vishy
Answers
Hi, I am also facing same issue. Please let me know if it is resolved.
I'm using this to force line break in excel :