views:

147

answers:

3

Hi everyone,

I'm have a hard time getting the account number to display correctly when exporting data from database to an Excel spreadsheet. Please see the attach image.

alt text

Under Company Name column "Company Name" and "AMCE" account number are showing up correctly. "Baba Gump" and "Another Name" is not display correctly. Users would have to double in the cell to see the whole account number. I have Googled this issue and none of the solutions that I've tried worked. Can someone tel me how can i correct this? Thank your in advance for you help!

A: 

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.

Dave Ferguson
Hi Dave, I'll also try your request tomorrow morning. Thanks for your response!
Hi Dave, this didn't work for me. Thank for your suggestion.
+4  A: 

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

buckbova
Hi buckbova, thank for your response. I'll try your suggestion first thing tomorrow morning.
It works, thanks for your suggestion Buckbova!
A: 

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"&gt;
<body>
<table>
 <tr>
  <td style='mso-number-format:"\@";'>510074123456989</td>
 </tr>
</table>
</body>
</html>
Leigh