Results 1 to 2 of 2

Thread: Output to Excel

  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Output to Excel

    I have a page that outputs a html table to excel using

    Response.ContentType = "application/vnd.ms-excel"

    and it works great but I noticed that one column gets treated as Number (as Excel likes to do) and I want it to see it as Text in order to prevent leading zeros from being deleted. any ideas?

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Output to Excel

    Add an apostrophe to the beginning of the value for that cell:
    00123 = '00123

    Excel will always display values as text that start with a leading apostrophe.

Posting Permissions

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