how can read MS-Word document
Hi buddies,
I'm here want to put a php query, i.e i want to read a Microsoft word document using php and display at the html page. i was try the following code but couldn't find satisfactory response :
<?php
// starting word
$word = new COM("word.application") or die("Unable to instantiate Word");
print "Loaded Word, version {$word->Version}\n";
//bring it to front
$word->Visible = 1;
//open an empty document
$word->Documents->Add();
//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");
//closing word
$word->Quit();
//free the object
$word->Release();
$word = null;
?>
I have got the error:
Fatal error: Uncaught exception 'com_exception' with message 'Error [0x80020003] Member not found' in C:\Program Files\xampp\htdocs\test\read_word1.php:20 Stack trace: #0 C:\Program Files\xampp\htdocs\test\read_word1.php(20): com->Release() #1 {main} thrown in C:\Program Files\xampp\htdocs\test\read_word1.php on line 20.
I'm using php 5.1.6 with xampp at windows environment.
Please, give he some help.
jaiprakash kumar
|