Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ASP To Excel Problem

    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?

    Thanks,
    NeoCool

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    How are you sending the data to Excel?

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    Regular Coder
    Join Date
    Sep 2004
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Found an answer: http://support.microsoft.com/default...39&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.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post
    Nice find, and I appreciate you posting your findings
    I would rather be a lion for a day than a lamb that lives forever.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •