andz Posted March 18, 2008 Share Posted March 18, 2008 Good day everyone. I have a problem on my project that I need to approach as soon as possible. How do I create an MsWord document using PHP and populate its content with MySQL without installing additional resources or in short just simply native PHP coding, no other script attached. I'm using PHP4. Thank you very much. Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted March 18, 2008 Share Posted March 18, 2008 is PHP COM installed? if not, i can't think of a way to do it. Quote Link to comment Share on other sites More sharing options...
Barand Posted March 18, 2008 Share Posted March 18, 2008 see http://web.informbank.com/articles/technology/php-office-documents.htm Quote Link to comment Share on other sites More sharing options...
andz Posted March 18, 2008 Author Share Posted March 18, 2008 How would I know if the PHP COM is installed or not? This is my first time to handle this kind of issue. Thanks for showing interest on my post. I'll check out the link... Thanks. Quote Link to comment Share on other sites More sharing options...
Barand Posted March 18, 2008 Share Posted March 18, 2008 How would I know if the PHP COM is installed or not? <?php phpinfo(); ?> Quote Link to comment Share on other sites More sharing options...
andz Posted March 18, 2008 Author Share Posted March 18, 2008 I have here a simple solution and it works for me. I just take the old-fashioned way using fopen() and fwrite() and fclose(); here's the code below. <?php $txtFile = fopen('file.doc') or die('UNABLE TO OPEN'); $input = 'Hello world'; if (!fwrite($txtFile, $input)) { die ('UNABLE TO WRITE'); } fclose($txtFile); ?> I'm running an xampp on windows as web server. Probably if this will work on live server, i'll just have to edit the permissions into *777. What do you think??? Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted March 18, 2008 Share Posted March 18, 2008 it's not a word doc, it's a text file with a .doc extension. but if it works for you that's fine. Quote Link to comment Share on other sites More sharing options...
andz Posted March 18, 2008 Author Share Posted March 18, 2008 Any disadvantages using this one for generating a file? Quote Link to comment Share on other sites More sharing options...
andz Posted March 18, 2008 Author Share Posted March 18, 2008 Thanks for the help... I'll just have to try it to linux if the generated file can be open using openoffice. Topic Solved. !!! Thanks so much. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.