php调用COM

WBOY
WBOYOriginal
2016-06-23 14:35:251064browse

这里是一个PHP用COM操作windows下word的过程

PHP代码

     // create a reference to a new COM component (Word)    $word = new COM("word.application") or die("Can't start Word!");        // print the version of Word that's now in use    echo "Loading Word, v. {$word->Version}
";        // set the visibility of the application to 0 (false)     // to open the application in the forefront, use 1 (true)    $word->Visible = 0;        // create a new document in Word    $word->Documents->Add();        // add text to the new document    $word->Selection->TypeText("Testing 1-2-3...");        //save the document in the Windows temp directory    $word->Documents[1]->SaveAs("/Windows/temp/comtest.doc");        // close the connection to the COM component    $word->Quit();        // print another message to the screen    echo "Check for the file...";     ?>   
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:yum升级phpNext article:Rasmus Lerdorf---PHP's Creator