Formatting Excel spreadsheet with asp

Discussion in 'ASP General' started by Josh Schmidt, Nov 18, 2004.

  1. Josh Schmidt

    Josh Schmidt Guest

    I'm using the Excel application object to create a
    spreadsheet from a recordset. Everything seems to work
    fine except any date fields are not displaying properly.
    For example 4/18/2004 is displaying as 38095 in the
    spreadsheet.

    I loop through the recordset to display each row. The
    line that actually writes out the field is:

    objSpreadsheet.Cells(iRow, iCol).Value = objField.Value

    Any suggestions?

    Thanks,

    Josh Schmidt
    Josh Schmidt, Nov 18, 2004
    #1
    1. Advertising

  2. "Josh Schmidt" <> wrote in message
    news:74bd01c4cdbf$98eca630$...
    > I'm using the Excel application object to create a
    > spreadsheet from a recordset.


    Generally not a good idea:
    http://support.microsoft.com/default.aspx?scid=kb;en-us;257757

    > Everything seems to work
    > fine except any date fields are not displaying properly.
    > For example 4/18/2004 is displaying as 38095 in the
    > spreadsheet.
    >
    > I loop through the recordset to display each row. The
    > line that actually writes out the field is:
    >
    > objSpreadsheet.Cells(iRow, iCol).Value = objField.Value
    >
    > Any suggestions?


    Display ASP Results Using Excel in IE with MIME Types
    http://support.microsoft.com/default.aspx?scid=kb;en-us;199841

    How To Format Cell Data When You Are Creating an Excel File With an Active
    Server Pages Page
    http://support.microsoft.com/default.aspx?scid=kb;en-us;260239

    How to Create an Office Document in an ASP Application
    http://support.microsoft.com/default.aspx?scid=kb;en-us;301044

    To make sure you get formats right, "reverse engineer" the HTML by creating
    a sample file in Excel and save it as HTML - look at the resulting HTML as
    an example of what you need to do.
    Tom Kaminski [MVP], Nov 19, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken Cox [Microsoft MVP]

    Re: Converting XML spreadsheet to native Excel in ASP.NET

    Ken Cox [Microsoft MVP], Jul 1, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    6,441
    Steven Cheng[MSFT]
    Jul 2, 2004
  2. lds
    Replies:
    2
    Views:
    545
  3. lds
    Replies:
    0
    Views:
    448
  4. Uma Muthu

    Import an excel spreadsheet in ASP.NET

    Uma Muthu, Apr 7, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    4,665
    Uma Muthu
    Apr 10, 2006
  5. + DiamondEagle

    Formatting asp generated spreadsheet

    + DiamondEagle, Jul 28, 2004, in forum: ASP General
    Replies:
    1
    Views:
    84
    Manohar Kamath [MVP]
    Jul 28, 2004
Loading...

Share This Page