[提问]PHP 读取 word COM 组件的错误信息 我很是无语啊!!!!
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
<?php
// 建立一个指向新COM组件的索引
$word = new COM("word.application") or die("Can't start Word!");
//打开一个文档
$word->Documents->OPen("F:/wamp/www/oa/111.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("F:\wamp\www\oa\111.doc");
// 关闭与COM组件之间的连接
$word->Quit();
?>
全网最新最细最实用WPS零基础入门到精通全套教程!带你真正掌握WPS办公! 内含Excel基础操作、函数设计、数据透视表等
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号