Export to Excel not displaying numbers correctly

前端 未结 3 724
日久生厌
日久生厌 2020-12-12 02:30

I\'m having a hard time getting account numbers to display correctly when exporting data from database to an Excel spreadsheet. The account number for one company, shows up

相关标签:
3条回答
  • 2020-12-12 02:37

    This usually happens when the column is not wide enough to display the data. Try and make the column wider and see if that corrects the issue.

    0 讨论(0)
  • 2020-12-12 02:45

    If you are exporting html, you could also use the xml mso schema properties to format the number as text, without changing the actual cell value ie adding an apostrophe.

    <cfheader name="Content-Disposition" value="inline; filename=someFile.xls"> 
    <cfcontent type="application/vnd.ms-excel">
    <html xmlns:o="urn:schemas-microsoft-com:office:office"
        xmlns:x="urn:schemas-microsoft-com:office:excel"
        xmlns="http://www.w3.org/TR/REC-html40">
    <body>
    <table>
     <tr>
      <td style='mso-number-format:"\@";'>510074123456989</td>
     </tr>
    </table>
    </body>
    </html>
    
    0 讨论(0)
  • 2020-12-12 02:51

    You can insert an apostrophe ' preceding the account number. This will force excel to treat numeric (any) data as text.

    0 讨论(0)
提交回复
热议问题