solution for exporting long number strings to Excel
solution for exporting long number strings to Excel
mnbob70
Posts: 23Questions: 2Answers: 0
I had the same need as this discussion and never found a final solution. After 1.5 days of searching the web and experimentation I came up with the following which correctly displays the text for the columns (E, L, R) that I'm trying to export.
customize: function (xlsx) {
let sheet = xlsx.xl.worksheets['sheet1.xml'];
['E', 'L', 'R'].forEach(function (value, key) {
let data = $('row:gt(0) c[r^="' + value + '"]', sheet).text();
let inlineString = '<is><t>' + data + '</t></is>';
$('row:gt(0) c[r^="' + value + '"]', sheet).find('v').remove();
$('row:gt(0) c[r^="' + value + '"]', sheet).removeAttr('s').attr('t', 'inlineStr').append(inlineString);
});
},
Replies
Need to do some more testing as I have some reports of files needing repair.
This update deals with a column where the data is already a string. I didn't realize that one of the columns of data I was working with didn't just consist of digits. This searches for a "v" element and only replaces the v element with an inline string if it exists. If no "v" element exists, then the data is already a string.
Nice, thanks for posting!
Colin
Doh! The following is needed to apply the changes per row: