By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

ASP export to Excel - text formatting problem

P: 87
Greetings,

I have a Classic ASP-based webpage that, on the click of a button, generates a dynamic result set that exports into Microsoft Excel using the following method:

Expand|Select|Wrap|Line Numbers
  1. <% Response.ContentType = "application/vnd.ms-excel" %>
There's one field in the Excel export that gets messed up because Excel reads it as a number, not text, so it looks like this: 9.15612821237297E+21. The field displays correctly when the recordset is displayed in the browser.

Does anyone have any suggestions how I can pass the exported value to Excel so it will display correctly?

Regards,

j
Nov 16 '10 #1

✓ answered by jhardman

Excel prefers that you escape numerical values with an apostrophe ("'98765" instead of "98765"). Try that and see if it works.

Jared

Share this Question
Share on Google+
2 Replies


jhardman
Expert 2.5K+
P: 3,405
Excel prefers that you escape numerical values with an apostrophe ("'98765" instead of "98765"). Try that and see if it works.

Jared
Nov 17 '10 #2

P: 87
Very clever, Jared. I didn't think of that. I put an apostrophe in the result set code and it works. The apostrophe appears in the field, but at least I can see the value now. Thanks.
Nov 17 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.