在Windows系统下用PHP读取Word文档内容并在网页上原样输出,在PHP官网上下的COM实例也会报错,求代码...
--------------------PHP代码--------------------------<?php//启动word$word=newCOM("word.ap...
--------------------PHP代码--------------------------
<?php
// 启动 word
$word = new COM("word.application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}\n";
//将其置前
$word->Visible = 1;
//打开一个空文档
$word->Documents->Add();
//随便做些事情
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");
//关闭 word
$word->Quit();
//释放对象
$word->Release();
$word = null;
?>
--------------------报错信息----------------------
Loaded Word, version 12.0
Fatal error: Call to undefined method variant::SaveAs() in D:\www\fopen\fopen.php on line 11
----------------------------------------------------
也用过antiword来取word文档里的内容,英文能取出来但是中文就被替换为“??”;图片就被替换为“[pic]”显示了求解啊
----------------------------------------------------
如果有其他办法也行,求大牛指示 :) 展开
<?php
// 启动 word
$word = new COM("word.application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}\n";
//将其置前
$word->Visible = 1;
//打开一个空文档
$word->Documents->Add();
//随便做些事情
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");
//关闭 word
$word->Quit();
//释放对象
$word->Release();
$word = null;
?>
--------------------报错信息----------------------
Loaded Word, version 12.0
Fatal error: Call to undefined method variant::SaveAs() in D:\www\fopen\fopen.php on line 11
----------------------------------------------------
也用过antiword来取word文档里的内容,英文能取出来但是中文就被替换为“??”;图片就被替换为“[pic]”显示了求解啊
----------------------------------------------------
如果有其他办法也行,求大牛指示 :) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询