Web Hosting Talk







View Full Version : PHP: Creating a .doc


MGHosted.net
06-27-2005, 11:25 AM
How do I put text into a .doc and then write it to the server?

Slidey
06-27-2005, 11:37 AM
.doc as in a plain textfile, or .doc as in a wordfile?

MGHosted.net
06-27-2005, 12:04 PM
As In a word file

TDMWeb
06-27-2005, 12:37 PM
You will likely be better off creating a .RTF file which can be read easily by Word. MS Word is not a simple file format.

dgeorge
06-27-2005, 01:45 PM
there is an article over on phpbuilder dot com
that talks about how to create word documents on the fly

www dot phpbuilder dot com/columns/yunus20031124.php3

basically:

$word=new COM("Word.Application") or die("Cannot start word for you");
echo "Using word version ($word->Version)";

$word->visible =1 ;
$word->Documents->Add();
$word->Selection->Typetext("Writing Text ....");
$word->Documents[1]->SaveAs("c:test.doc");
$word->Quit();

MGHosted.net
06-27-2005, 02:47 PM
Thanks for the link, dgeorge.

I have decided to do it in RTF format, how do I do this?

dgeorge
06-27-2005, 02:55 PM
Using PHP for RTF
www dot phpbuilder dot com/columns/nair20020523.php3?page=1

Free RTF Class
www dot smartsystems dot ro/rtfgen_be.html

xelav
06-27-2005, 05:04 PM
If your server is windows based, just use COM calls.
You can create RTF manually, but many possibilities are not allowed. One of the solutions - use word html document with word doctype (word can create the one if you save as web-page)

Try google or msn for more information