stephen-hardy / xlsx.js

XLSX.js is a JavaScript library for converting the data in base64 XLSX files into JavaScript objects - and back! Please note that this library is licensed under the Microsoft Office Extensible File License - a license NOT approved by the OSI. While this license is based off of the MS-PL, which is OSI-approved, there are significant differences.
http://blog.innovatejs.com/?tag=xlsx-js
Other
575 stars 122 forks source link

Phone numbers with leading + #30

Open trapias opened 10 years ago

trapias commented 10 years ago

Hello, I have an issue with phone numbers which apparently is similar to issue #5 . I generate my xlsx from json like:

 {
      "row": "1",
      "name": "John",
      "phone": "+411234567890"
    }

All data is interpreted as string by xlsx.js, but then Excel 2013 tells the file is corrupted; recoverig is successfull, but I wish to supress the error. The problem is with the leading "+" char: if I remove it, or put an apice before it when I generate my excel rows, all works pretty good.

Is there a way to keep this char, but encode it so that Excel does not give errors opening file? Thanks for any suggestion, al.

trapias commented 10 years ago

I managed to let Excel open the file without errors by adding a blank after the + sign, e.g. passing the number as "+ 411234567890" instead of "+411234567890". Would like anyway to understand if it's possible to better handle this.