View Full Version : ASP To Excel Problem

09-07-2005, 09:11 PM
Ok, my client wants a downloadable excel file for reporting. I thought, no problem. Then I started testing the code. Here is my issue. The primary key in the main table is a char(12) (I know, it was out of my hands). The problem is the value for this field can be any combination of numbers, but will always be 12 characters. For example, one of the ids is "000000999999". When you view the excel file, excel is truncating the leading 0's. So I thought, well I'll put a tick in front of it just as you would in Excel so that Excel knows to treat it as a text instead of numeric value. However, now it's displaying the tick. I've tried using ', ´, ‘ and ’, but none of them work. Any ideas?


09-07-2005, 09:32 PM
How are you sending the data to Excel?

09-07-2005, 09:41 PM
Found an answer: http://support.microsoft.com/default.aspx?scid=kb;en-us;260239&Product=xlw

Basically, it's an asp page with a Response.ContentType = "application/vnd.ms-excel" at the top so that it becomes an excel document.

09-08-2005, 03:55 PM
Nice find, and I appreciate you posting your findings :thumbsup: