您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP读取word文档内容的方法,该怎么处理

2025/5/3 4:11:29发布31次查看
php读取word文档内容的方法
version}
”; 
// 把它的可见性设置为0(假),如果要使它在最前端打开,使用1(真) 
// to open the application in the forefront, use 1 (true) 
//$word->visible = 0; 
//打?一个文档 
$word->documents->open(e:\wamp\www\oa\121.doc); 
//读取文档内容 
$test= $word->activedocument->content->text; 
echo $test; 
echo

//将文档中需要换的变量更换一下 
$test=str_replace(,这是变量,$test); 
echo $test; 
$word->documents->add(); 
// 在新文档中添加文字 
$word->selection->typetext($test); 
//把文档保存在目录中 
$word->documents[1]->saveas(e:/wamp/www/oa/121.doc); 
// 关闭与com组件之间的连接 
$word->quit();
?>
错误报告
fatal error: uncaught exception 'com_exception' with message 'failed to create com object `word.application': îþð§µäóï·¨ ' in e:\wamp\www\oa\newfile.php:3 stack trace: #0 e:\wamp\www\oa\newfile.php(3): com->com('word.applicatio...') #1 {main} thrown in e:\wamp\www\oa\newfile.php on line 3
我想问一个com 是这个一个什么东西啊!! 在哪里
$test=str_replace(,这是变量,$test); 这里的变量又要怎么写
------解决方案--------------------
com 是微软的一种信息服务组件
你的这个程序运行的条件是:你的服务器已经安装了 word97 到 word2003 之间的版本
------解决方案--------------------
我以前试着做pdf转word的时候测试了下 发下通过php去读写word好慢 我建议别做 我当时用的是win7+apache+php+mysql,浏览器测试过ie,360,世界之窗
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product