PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
You could try looking at OpenOffice as that can save 'Word compatible' files I would presume there is something about the file structure/format in there.
<?
$word=new COM("word.application") or die("Cannot start MS Word");
print "Loaded word version ($word->Version)\n";
$word->visible = 1 ;
$word->Documents->Add();
$word->Selection->Typetext("This is a test");
?>
You will also have to visit microsofts site to find out how to do all the writing and reading of the files. I have only used it for writing, but anything the user can do, you can do.
~malcolmboston: I saw that too, but I am working on a Linux box.
~redmonkey: Thanks for the tab character. I want to output a .doc file from a PHP generated webpage, not a gui word processor. Thanks though.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
My suggestion is not that you use Openoffice but, as it has the ability to save as 'Word compatible' files then there is probably some comenting in the source with regard to the file structure/format they use.
From that you can work out how to write 'Word compatible' files.
pickle - Word for a few versions now has saved its files in an XML format instead of the closed proprietary format Microsoft used to use a few years ago. There is book by O'Reilly dedicated to parsing the XML Office format, it might be worth taking out of the local library/etc? Can't remember the name off-hand, but it wouldn't take 10 seconds on Google to find it.