Copy the Code code as follows:
Establish an index to the new COM component
$word = new COM ("Word.Application") or Die ("Can ' t start word!");
Displays the version number of the word that is currently in use
echo "Loading Word, v. {$word->version}
”;
Set its visibility to 0 (false), use 1 (true) if you want to make it open in the front-end
To open the application in the forefront, use 1 (true)
$word->visible = 0;
Hit a document.
$word->documents->open ("D:\myweb\muban.doc");
Read Document Contents
$test = $word->activedocument->content->text;
Echo $test;
echo "
”;
Change the variable you want in your document
$test =str_replace ("<{variable}>", "This is a variable", $test);
Echo $test;
$word->documents->add ();
Add text to a new document
$word->selection->typetext ("$test");
Save the document in the directory
$word->documents[1]->saveas ("D:/myweb/comtest.doc");
To close a connection to a COM component
$word->quit ();
?>
The above describes the word2003 Simplified Chinese version of the code to read and write Word documents in PHP, including the word2003 Simplified Chinese version of the content, I hope to be interested in PHP tutorial friends helpful.