Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script for downloading word documents 1

Status
Not open for further replies.

misslois74

Programmer
Sep 27, 2008
63
PH
im currently working on a page that has a facility to include a word document in which it can be downloaded by the user or whoever visited the site...
i dont have any idea how to go about it.
hope you could help me with these...
thanks in advance...
 
A link to the location of the word document is usually the way to go:

<a href="path/to/word/file.doc"> Download Word Doc</a>


If I'm misunderstanding perhaps you can explain further what it is you want.




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
im including an application form on the page in which i would want the user to have the option to download that document file for filling up and printing purpose....
 
If you have the form in word format prior to this, use a link. If you want to dynamically generate the Word document, which I find a little pointless unless the Application form changes with each user, there a few things you can do.

You can use fopen and fwrite to write the HTMl directly into a file and give it a doc extension:


Code:
$htmlstring="<table border='2'><tr><td>Field 1</td><td>Field 2</td></tr><td><input type=text name='textbox1'></td><td><input type=text name='textbox2'></td></tr></td>";

$doc=fopen("worddoc.doc","w");

fwrite($doc,$htmlstring);

fclose($doc);

Or use COM class to instantiate Word and generate a true Word document.





----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top