Formatting Excel spreadsheet with asp

J

Josh Schmidt

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
 
T

Tom Kaminski [MVP]

Josh Schmidt said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top