471,122 Members | 1,237 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,122 software developers and data experts.

ASP export to Excel - text formatting problem

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

2 4670
jhardman
3,406 Expert 2GB
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
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.

Similar topics

6 posts views Thread by shoo | last post: by
reply views Thread by ald | last post: by
6 posts views Thread by Tomasz J | last post: by
3 posts views Thread by =?Utf-8?B?b24tbGluZSBqb3VybmFsIGVkaXRvcg==?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.