aldrin151 Posted August 19, 2008 Share Posted August 19, 2008 Anyone know how to open a different application beside MS word, or excel for example in PHP to be able to read text content...I have tried the below code and works trying to open and read a word .doc file and then close word in the background...my only problem is that I'm trying to use a UNIX or Linux server and not a Windows to make this work...any solutions will be greatly appreciated! Thanks <?php $word = new COM("word.application") or die ("Could not initialise MS Word object."); $word->Documents->Open(realpath("test.doc")); // Extract content. $content = (string) $word->ActiveDocument->Content; echo $content; $word->ActiveDocument->Close(false); $word->Quit(); $word = null; unset($word); ?> Link to comment https://forums.phpfreaks.com/topic/120414-trying-to-read-content-of-a-document-in-php/ Share on other sites More sharing options...
Mchl Posted August 19, 2008 Share Posted August 19, 2008 There's OpenOffice Thing is, COM extension is Windows specific. Link to comment https://forums.phpfreaks.com/topic/120414-trying-to-read-content-of-a-document-in-php/#findComment-620459 Share on other sites More sharing options...
aldrin151 Posted August 19, 2008 Author Share Posted August 19, 2008 Thanks Mchl, I saw openoffice the only problem is I can't find what you specify in the php code when you call the openoffice application example for word I say: new COM("word.application") Link to comment https://forums.phpfreaks.com/topic/120414-trying-to-read-content-of-a-document-in-php/#findComment-620465 Share on other sites More sharing options...
Mchl Posted August 19, 2008 Share Posted August 19, 2008 You won't be able to use COM on Linux/Unix server, so does it matter? Link to comment https://forums.phpfreaks.com/topic/120414-trying-to-read-content-of-a-document-in-php/#findComment-620467 Share on other sites More sharing options...
aldrin151 Posted August 19, 2008 Author Share Posted August 19, 2008 Sure, but is there a way to call Openoffice, meaning what do you specify in the code to tell openoffice or some other application to open in the background? Link to comment https://forums.phpfreaks.com/topic/120414-trying-to-read-content-of-a-document-in-php/#findComment-620492 Share on other sites More sharing options...
Mchl Posted August 19, 2008 Share Posted August 19, 2008 http://www.php.net/manual/en/ref.exec.php perhaps? Link to comment https://forums.phpfreaks.com/topic/120414-trying-to-read-content-of-a-document-in-php/#findComment-620496 Share on other sites More sharing options...
aldrin151 Posted August 19, 2008 Author Share Posted August 19, 2008 thanks for the referral, I'll look it up Link to comment https://forums.phpfreaks.com/topic/120414-trying-to-read-content-of-a-document-in-php/#findComment-620517 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.