下面我们利用windown com组件来实现doc文件一些简单的操作,希望对你有所帮助,实例代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <?php
$word = new COM( "word.application" ) or die ( "Can't start Word!" );
echo $word ->Version;
$word ->Documents->OPen( "C:wampwwwtest1.doc" );
$test = $word ->ActiveDocument->content->Text;
echo $test ;
echo '<br>';
$test = str_replace ('<{变量}>','这是变量', $test );
echo $test ;
$word ->Documents->Add();
$word ->Selection->TypeText(' $test ');
$word ->Documents[1]->SaveAs( "C:wampwwwtest2.doc" );
$word ->Quit();
|
Copy after login
教程网址:
欢迎收藏∩_∩但请保留本文链接。