convert doc to text
Posted: Mon May 17, 2010 1:23 am
hi i i have written the code doc to text but error is display
<?php
$filename="cv.doc";
$TXTfilename = $filename . ".txt";
$word = new COM("word.application") or die("Unable to instantiate Word object");
$word->Documents->Open($filename);
$word->Documents[1]->SaveAs($TXTfilename ,2);
$word->Documents[1]->Close(false);
$word->Quit();
$word->Release();
$word = NULL;
unset($word);
$content = file_get_contents($TXTfilename);
unlink($TXTfilename);
?>
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Word<br/><b>Description:</b> This file could not be found. (C:\WINDOWS\system32\cv.doc)' in C:\wamp\www\readword _doc\sample_new\sample1.php:5 Stack trace: #0 C:\wamp\www\readword _doc\sample_new\sample1.php(5): variant->Open('cv.doc') #1 {main} thrown in C:\wamp\www\readword _doc\sample_new\sample1.php on line 5
<?php
$filename="cv.doc";
$TXTfilename = $filename . ".txt";
$word = new COM("word.application") or die("Unable to instantiate Word object");
$word->Documents->Open($filename);
$word->Documents[1]->SaveAs($TXTfilename ,2);
$word->Documents[1]->Close(false);
$word->Quit();
$word->Release();
$word = NULL;
unset($word);
$content = file_get_contents($TXTfilename);
unlink($TXTfilename);
?>
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Word<br/><b>Description:</b> This file could not be found. (C:\WINDOWS\system32\cv.doc)' in C:\wamp\www\readword _doc\sample_new\sample1.php:5 Stack trace: #0 C:\wamp\www\readword _doc\sample_new\sample1.php(5): variant->Open('cv.doc') #1 {main} thrown in C:\wamp\www\readword _doc\sample_new\sample1.php on line 5