Export Excel treats the string as a number

Export Excel treats the string as a number

Luca4k4Luca4k4 Posts: 9Questions: 3Answers: 0

Hi,
I tried to search but with no luck (the question is already asked but the solutions don't work): i'm using ExcelHtml5 to export data from table to xlsx, i have a column with 5 numbers and the first could be zeros. When i export as xlsx i get them truncated (137 where 00137).

I tried to remove the if: "typeof row[i] === 'number' .... " from buttons.html5.js with no luck.
Then i inserted this in the column definition:

{ "name": 'Cap', render: function (data, type, row) {
       return type === 'export' ? '="'+data+'"' : data;
} }

but with Excel 2016 i see: ="00137" in the field.

There are any solutions to show numbers as strings in the xlsx file?

Replies

  • allanallan Posts: 63,087Questions: 1Answers: 10,386 Site admin

    That's a bug in the current release I'm sorry to say. This PR should fix it.

    Allan

  • Luca4k4Luca4k4 Posts: 9Questions: 3Answers: 0

    This worked at all!
    Thank you so much Allan (and NickMaev for the solution!)

    Waiting the next release... :)

This discussion has been closed.