Important alert: (current site time 7/15/2013 10:40:04 PM EDT)
 

VB icon

ASP to Word

Email
Submitted on: 10/27/2003 10:59:53 AM
By: Sam Collett 
Level: Intermediate
User Rating: By 5 Users
Compatibility: ASP (Active Server Pages)
Views: 15922
 
     Convert ASP pages to Microsoft Word document
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: ASP to Word
' Description:Convert ASP pages to Microsoft Word document
' By: Sam Collett
'
' Returns:Web page as Word document attachment. User prompted to save/open page.
'
' Assumes:Web pages are opened in Word, when this code is added to the top of the page. Word needs to be installed on the clients machine for this to work. No server controls needed.
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=8596&lngWId=4'for details.'**************************************

<%
Response.ContentType = "application/msword"
Response.AddHeader "Content-Disposition","attachment;filename=filename.doc"
%>


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
10/28/2003 3:04:13 AM

that's just a header. a better solution would be to use COM objects, server-side.

also, RTF files would be a better solution than Word, because they're compatible on non-Windows machines.

just my opinion though...
(If this comment was disrespectful, please report it.)

 
4/26/2004 6:42:48 AMmiral

I tried to save a variable containg HTML formatted text to a word document using the options above but the new word document contains also the html tags.
I am using an ASP page, IIS 5, 2000 professional.
Maybe you know how I can make it to recognize the HTML formatting.
Thanks in advance,
Raluca Mihu
(If this comment was disrespectful, please report it.)

 
6/7/2004 4:11:55 PM

Hi there!! is usefull know how to manipulate the html code on word but I wondered if there are some other instructions that parse the same output window of the explorer into word without code tags. Thanks for this tips is very usefull for programers Congratulations!
(If this comment was disrespectful, please report it.)

 
4/24/2009 3:06:04 AM74

7u4r
(If this comment was disrespectful, please report it.)

 
4/24/2009 3:06:22 AM74

dfrhfh
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.