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. Link to comment https://forums.phpfreaks.com/topic/96774-solved-need-help-how-to-create-msword-using-php/ 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. Link to comment https://forums.phpfreaks.com/topic/96774-solved-need-help-how-to-create-msword-using-php/#findComment-495232 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 Link to comment https://forums.phpfreaks.com/topic/96774-solved-need-help-how-to-create-msword-using-php/#findComment-495235 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. Link to comment https://forums.phpfreaks.com/topic/96774-solved-need-help-how-to-create-msword-using-php/#findComment-495243 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(); ?> Link to comment https://forums.phpfreaks.com/topic/96774-solved-need-help-how-to-create-msword-using-php/#findComment-495252 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??? Link to comment https://forums.phpfreaks.com/topic/96774-solved-need-help-how-to-create-msword-using-php/#findComment-495254 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. Link to comment https://forums.phpfreaks.com/topic/96774-solved-need-help-how-to-create-msword-using-php/#findComment-495278 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? Link to comment https://forums.phpfreaks.com/topic/96774-solved-need-help-how-to-create-msword-using-php/#findComment-495294 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. Link to comment https://forums.phpfreaks.com/topic/96774-solved-need-help-how-to-create-msword-using-php/#findComment-495319 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.