How to make 2 changes to text-data when exporting to excel?
How to make 2 changes to text-data when exporting to excel?
mesqueeb
Posts: 38Questions: 12Answers: 1
Down below is my script to edit data before exporting to excel.
I tried adding a second change which I commented out. This is the one that bugs.
Is there any way to do both these changes to the data before exporting to excel?
I want to create newlines and then remove all remaining excel tags.
var fixNewLine = {
exportOptions: {
format: {
body: function ( data, column, row ) {
// Strip $ from salary column to make it numeric
return column === 5 ?
data.replace( /<br\s*\/?>/ig, "\n"):
data;
// data.replace( /<.*?>/ig, ""):
// data;
}
}
}
};
This discussion has been closed.
Answers
I am facing same problem ...
An older question, but since someone is facing the same problem more recently...
The javascript function replace allows chaining. So you can do the following: