Issues to Export data to Excel
Issues to Export data to Excel
Hello everybody!
I'm newbie in datatables API and I'm found some issues to export data for Excel. The fist issue is that I need to whart text in same cell. for this topic I found a alternative solution passing the information as formula. The problem is I need to replace = to = to excel understand that I'm working with formulas and a I need to active the option in excel to wrap text in excel.
I tried to look in others topics but I didn't found a solution...
Below you can check my javascript code:
$(document).ready(function () {
$('#datatable').DataTable({
keys: true,
dom: 'Bfrtip',
lengthMenu: [
[10, 25, 50, -1],
['10 rows', '25 rows', '50 rows', 'Show all']
],
buttons: ['pageLength',
{
extend: 'excelHtml5',
autoFilter: true,
text: 'Export to Excel',
title: 'Pré Configurador',
exportOptions: {
format: {
body: function (data, row, column, node) {
//if it is html, return the text of the html instead of html
data = "=\"" + data.replace(/<br>/g, "\"&CARACTUNICODE(10)&\"") + "\""
data = remove_tags(data);
$(this).attr('s', '55');
return data;
}
}
}
}
]
});
});
Could you please helo me?
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This question has an accepted answers - jump to answer
Answers
This thread should help, it's asking the same thing.
Cheers,
Colin
Hello Colin,
Thanks a lot for your help. I found a solution for my issue based on the thread indicated for you.
Cheers
Wilson