Below we use the winddown com component to implement some simple operations on doc files. I hope it will be helpful to you.
Below we use the winddown com component to implement some simple operations on doc files. I hope it will be helpful to you.
// Create an index pointing to the new COM component
$test= $word->ActiveDocument->content->Text;echo $test;
$word = new COM("word.application") or die("Can't start Word!");
// Display the version number of Word currently being used
//echo “Loading Word, v. {$word->Version}
”;
// Set its visibility to 0 (false). To open the application in the forefront, use 1 (true)
//$ word->Visible = 0;
echo $word->Version;
//Echo a document
$word->Documents->OPen("C:wampwwwtest1.doc") ;
//Read document contentecho '< ;br>';
//Replace the variables that need to be replaced in the document
$test=str_replace('<{variable}>','This is a variable',$test);
echo $test;
$word->Documents->Add();
// Add text to the new document
$word->Selection->TypeText('$test') ;
//Save the document in the directory
$word->Documents[1]->SaveAs("C:wampwwwtest2.doc");
//Close the connection with the COM component Connect
$word->Quit();
?>