[提问]PHP 读取 word COM 组件的异常信息 小弟我很是无语啊
Jun 13, 2016 am 10:20 AM
com
gt
quot
wamp
word
[提问]PHP 读取 word COM 组件的错误信息 我很是无语啊!!!!
- PHP code
<!--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(); ?>
Copy after login
IE 浏览器下的错误报告
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `word.application': 尚未调用 CoInitialize。 ' in F:\wamp\www\oa\newfile.php:3 Stack trace: #0 F:\wamp\www\oa\newfile.php(3): com->com('word.applicatio...') #1 {main} thrown in F:\wamp\www\oa\newfile.php on line 3
遨游下的错误报告
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `word.application': 尚未调用 CoInitialize。 ' in F:\wamp\www\oa\newfile.php:3 Stack trace: #0 F:\wamp\www\oa\newfile.php(3): com->com('word.applicatio...') #1 {main} thrown in F:\wamp\www\oa\newfile.php on line 3
我求解释
------解决方案--------------------
应该是第一个实例没有关闭
------解决方案--------------------
问题出你的第三行啊。还是致命错误。 "F:/wamp/www/oa/111.doc 与 F:\wamp\www\oa\111.doc 你这个路径不是有问题吗? 仔细检查。
Statement of this Website
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

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot tools Tags

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to cancel automatic word wrapping in word

Detailed explanation of how to display the ruler in Word and how to operate the ruler!

How to add handwritten signature to word document

Specific steps to delete down arrow in Word!

Where is the shading setting in word?

How to automatically sort word serial numbers
