RE: [PHP] How to create doc file.
| From: | Jay Blanchard | Date: | Wed, 23 Jun 2004 12:50:42 +0000 |
| Subject: | RE: [PHP] How to create doc file. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-188868@lists.php.net to get a copy of this message | ||
[snip]
Please help me.
I need create *.doc file in php script. In this file, will be data from
mysql database.
Is it possible ?
[/snip]
http://catb.org/~esr/faqs/smart-questions.html
Yes it is possible. It requires that you have COM and a way to search
the internet for the answers. Google, being your friend and mine turned
up this little snippet of code.....
<?php
$word = new COM("word.application") or die("Unable to start Ms Word");
$word->Visible = 0;
//$contents will be the string you want to convert to a Word document
$word->Documents->Add("$contents");
$word->Documents[1]->SaveAs("filename.doc");
$word->Quit();
$word->Release();
$word = null;
?>