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;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