php and com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to start word using com and php. I am running php 5.04 and apache 2.054 on windows. I have used a simple example from the php site but cant get it working.

|<?php
// starting word
$word = new COM("word.application") or die("Unable to instantiate Word");
echo "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 = null;
?>

i have called this page testcom.php but when i try and view it with a clients browser i get this error:

[client xxx.xxx.xxx.xxx] PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `Word.application': Invalid syntax\r\n' in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\testcom.php:3\nStack trace:\n#0 C:\\Program Files\\Apache Group\\Apache2\\htdocs\\testcom.php(3): com->com('Word.applicatio...')\n#1 {main}\n thrown in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\testcom.php on line 3

|
Has anyone seen this error before or know what it means? Or if possible does anyone know of any good docs on using com with php?


Thanks in advance for any help!!

Cheers

Bob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux