Quantcast
Viewing all articles
Browse latest Browse all 82152

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?


Viewing all articles
Browse latest Browse all 82152

Trending Articles