I am really trying to use some codes found by me from http://php.net/manual/en/class.com.php
<?php
$word = new COM("word.application") or die("Unable to instantiate Word");
echo "Loaded Word, version {$word->Version}\n";
$word->Visible = 1;
$word->Documents->Add();
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");
$word->Quit();
$word = null;
?>
But this does not seem to work. I am using Word 2007 and I am getting the following:
Loaded word, version 12.0 Fatal error: call to undefined method: SaveAs () in C: \ xampp \ htdocs \ final \ testq.php on line 14
Can anyone solve this problem? Is it because I use Word 2007?
source
share