Extracting text from Word Documents via PHP and COM : COM (Windows) : COM and .Net (Windows) PHP Source Code


PHP Source Code » COM and .Net (Windows) » COM (Windows) »

 

Extracting text from Word Documents via PHP and COM


<?php
$word 
= new COM("word.application") or die ("Could not initialise MS Word object.");
$word->Documents->Open(realpath("Sample.doc"));

// Extract content.
$content = (string) $word->ActiveDocument->Content;

echo 
$content;

$word->ActiveDocument->Close(false);

$word->Quit();
$word null;
unset(
$word);
?>


HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo COM and .Net (Windows)
» COM (Windows)