ASP to Excel

August 12, 2004 by Carl Grint
Microsoft provide 3 lines of code which allows you to save ASP pages, including laid out in table format, as it would be in Excel, as either WORD or EXCEL. I am sure this must either work in .Net or there is a version to work with .Net Add the following code to a page, lay it out as you wish, for Excel I have found the easist thing is to Insert a Dynamic table, but you could simply enter a table and type in Headers and drag the Dataset columns into the table TD's. <% Response.ContentType = "application/vnd.ms-excel" Response.AddHeader "Content-Disposition","attachment;name.xls" %> For WORD use this <% Response.ContentType = "application/msword" Response.AddHeader "Content-Disposition","attachment;filename="name.doc" %> The files will output to Excel / Word when you select the link, giving you the option to Save or Open.

Link to document for the above

August 12, 2004 by Carl Grint
URL = http://localhost/cgw3_couk/www/tutorials/tutorial.asp?TutorialID=9&CategoryID=1 PS. not sure what happended with previous posting, it was formatted when I typed it.

doh

August 12, 2004 by Carl Grint
silly me, gave you the URL on my local machine, the actually URL is http://www.infinetsoftware.com/content/officedocuments.asp