ASP to EXCEL
am 31.08.2005 17:13:27 von DNKMCA
Hi,
Im creating an Excel file using ASP
Versions : Office 97
The formattting is not working properly in Excel 97, but the same works fine
in Office XP & 2000
Is there any additional code has to be added in my code to get a formatted
output in Excel 97 version?
Please help.
Thanks.
MyCode
---------
set Cn=server.createobject("ADODB.connection")
Cn.open sqlconstring
tfName = "salesexcel.xls"
set Rs=server.createobject("ADODB.recordset")
sql = "select * from sales WHERE month(saledate)=8 and day(saledate)=28
year(saledate)=2005"
Rs.open sql,Cn,1,3
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=" & tfName
if not rs.eof then
Response.write "
"
Response.write "ID | |
colspan='2'>ExecutiveSales Done |
"
while not rs.eof
Response.write ""
Response.write "" & rs(0) & | "
Response.write "" & rs(1) & | "
Response.write "" & rs(2) & |
"
rs.movenext
wend
enf if
Response.write "
"
set Cn = Nothing
------------------------------------------------------------ -
Re: ASP to EXCEL
am 08.09.2005 04:17:31 von Bullschmidt
Don't know if it's a typo but I did notice that you may want to change
this:
sql = "select * from sales WHERE month(saledate)=8 and day(saledate)=28
year(saledate)=2005"
To be more like this instead:
sql = "select * from sales WHERE month(saledate)=8 and day(saledate)=28
and year(saledate)=2005"
And maybe you want to create .csv files which can be opened in Excel.
Puzzle 5 Not much different from other solutions by Manohar Kamath
posted 1/12/99
http://www.asp101.com/puzzles/puzzle5_s7.asp
Puzzle 5 "Write delimited data to browser window" by Kirk Lockhart
posted on 12/21/98
Write the data in plain text to the browser window, and the user can
save the results as a plain text file and then import the data into
Excel or whatever application they want.
http://www.asp101.com/puzzles/puzzle5_s1.asp
Creating the Excel File Server Side
http://www.greggriffiths.org/webdev/both/excel/serverside.ht ml
Uses FSO to create a .csv file.
Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***