Error while opening Word docs

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vivekjain
Forum Commoner
Posts: 76
Joined: Thu Jan 08, 2004 12:38 am

Error while opening Word docs

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it appears you do not have Word installed on the server.
Post Reply