Tuesday, May 27, 2008

Export to Excel

// Mention below two lines in the asp page say "excel.asp"
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=sheet1.xls"

Now write the code for the data that should be displayed in the excel file in the excel.asp page
................

In another page say export.asp give a link "Export to excel"
The href for the link should be given as excel.asp
When you click this link it will prompt you to open or save the excel file

No comments: