ASP Hosting sale!
1,000MB space, 40GB transfer, 1 SQL Server 2000 db! - $9.95 per month*!
Limited Time Offer!

aspdev | articles | tutorials | forums

ASPdev -> All Articles -> Export ASP page to a Word document

Export ASP page to a Word document

There is a way to direct the html produced from an ASP page to Word document instead of displaying it in standard browser and in order to do that you have to change the content type of the server response.

Put the following line on the top of your ASP page:
<%
Response.ContentType = "application/vnd.ms-word"
%>

When you access this ASP page from your browser a Word document will be opened inside of the browser and all the content generated by the ASP page will appear in this document. You can modify and save this Word document as any other Word file. The following example will output a simple html inside of Word document:

<%
Response.Buffer = True
Response.ContentType = "application/vnd.ms-word"
Response.AddHeader "content-disposition", "inline; filename = ASP_Word_Doc.doc"
%>




Contact Us