Page 1 of 1

Error while opening Word docs

Posted: Thu Apr 21, 2005 1:32 am
by vivekjain
Hi,
I am tying to open a word doc using PHP, but am getting errors.

The code that I am using

Code: Select all

$word = new COM("word.application") or die("Unable to instanciate 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;
The output

Warning: main(): Unable to lookup Version: Error accessing the OLE registry. in c:\inetpub\wwwroot\StrAppWorks\testpages\WordToHTML\wth.php on line 21
Loaded Word, version
Warning: main(): Unable to lookup Visible: Error accessing the OLE registry. in c:\inetpub\wwwroot\StrAppWorks\testpages\WordToHTML\wth.php on line 24

Warning: (null)(): Unable to lookup Documents: Error accessing the OLE registry. in c:\inetpub\wwwroot\StrAppWorks\testpages\WordToHTML\wth.php on line 27

Warning: (null)(): Unable to lookup Selection: Error accessing the OLE registry. in c:\inetpub\wwwroot\StrAppWorks\testpages\WordToHTML\wth.php on line 30

Warning: (null)(): Unable to lookup Documents: Error accessing the OLE registry. in c:\inetpub\wwwroot\StrAppWorks\testpages\WordToHTML\wth.php on line 31

Warning: (null)(): Unable to lookup quit: Error accessing the OLE registry. in c:\inetpub\wwwroot\StrAppWorks\testpages\WordToHTML\wth.php on line 34

Posted: Thu Apr 28, 2005 5:42 pm
by feyd
it appears you do not have Word installed on the server.