TableExport
TableExport copied to clipboard
Escape cell if there's a comma
Table cells that contains commas are usually ignored if not causing misalignment, so we check if the text string contains a comma to escape it.
((val.textContent.indexOf(',') > -1) ? '"\'' : '"') + settings.formatValue(val.textContent.replace(/"/g, '""')) + '"';
The ES6 version of this solution is
`"'${settings.formatValue(val.textContent.replace(/"/g, '""'))}"`;
But we opted for the ES5 one for backwards compatibility, thanks!