Posted By

jonhenshaw on 09/12/08


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

luman
jamesming


Extracting text from Word Documents via PHP and COM


 / Published in: PHP
 

URL: http://www.developertutorials.com/blog/php/extracting-text-from-word-documents-via-php-and-com-81/

Requires an insecure, I mean Windows server (doh!)

  1. $word = new COM("word.application") or die ("Could not initialise MS Word object.");
  2. $word->Documents->Open(realpath("Sample.doc"));
  3. // Extract content.
  4. $content = (string) $word->ActiveDocument->Content;
  5. echo $content;
  6. $word->ActiveDocument->Close(false);
  7. $word->Quit();
  8. $word = null;
  9. unset($word);

Report this snippet  

You need to login to post a comment.