---恢复内容开始---

首先安装com扩展:

php.ini

php.ini 确保有此语句

[PHP_COM_DOTNET]
extension=php_com_dotnet.dll
 

php.ini中设置

com.allow_dcom = true

代码:

<?php
// starting word
$word = new COM("word.application") or die("Unable to instantiate Word");
echo "Loaded Word, version {$word->Version}\n"; //bring it to front
$word->Visible = 1; //open an empty document
$word->Documents->Add(); //do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc"); //closing word
$word->Quit(); //free the object
$word = null;
?>

总是报这个错:

Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `wps.application' in F:\xampp\htdocs\php\curl\phpWord.php on line 2

找了好多解决方法,还是不行:

http://www.haosblog.com/?mod=article_read&id=386

算了,不用Com调用了,在网上搜了一个比较出名的库PHPWord,不需要安装,直接调用库文件就可以了。

地址:http://phpword.codeplex.com/documentation

更多:http://www.cnblogs.com/phphuaibei/archive/2011/11/30/2269427.html

下载的文件夹里面有许多丰富的例子,可以作为参考.

找了半天想读取word,可以没有找到文档,最后发现该库仅仅是创建word文件,不能读取

---恢复内容结束---

最新文章

  1. 烂泥:wiki系统confluence5.6.6安装、中文、破解及迁移
  2. ASP.NET MVC铵钮Click后下载文件
  3. Hadoop step by step _ install and configuration environment
  4. hive-jdbc/odbc的解读和看法
  5. 用ie调试的时候显示:脚本调试程序无法连接到目标进程,已附加调试程序。
  6. 转: Android官方培训课程中文版(v0.9.5)
  7. jQuery EasyUI 数据网格 - 启用行内编辑(转自http://www.runoob.com/jeasyui/jeasyui-datagrid-datagrid12.html)
  8. php 操作数组 (合并,拆分,追加,查找,删除等)
  9. NPOI常用功能工具类
  10. bzoj1379 [Baltic2001]Postman
  11. ActionBar-PullToRefreshLibs+沉浸式在部分手机上的布局错乱,目前知道的三星
  12. Swift - 给表格UITableView添加索引功能(快速定位)
  13. ReactNative问题随记1 Exception in thread &quot;main&quot; java.lang.RuntimeException: gradle-2.14.1-all.zip
  14. linux下的启停脚本
  15. 深度学习原理与框架- batch_normalize(归一化操作)
  16. JSON基础知识点
  17. python(1):数据类型/string/list/dict/set等
  18. linux sed 常见字符串处理
  19. List遍历Java 8 Streams map() examples
  20. JSON实例(单对象)

热门文章

  1. Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50096, now running 50173.
  2. 多态 JAVA
  3. hdu 4499 Cannon(暴力)
  4. 解决git提交问题error: The requested URL returned error: 403 Forbidden while accessing
  5. [ES6] ... spread operator
  6. Linux内核启动分析
  7. 一键cobbler批量安装脚本
  8. Android Studio错误
  9. Arcgis Desktop 9.3 安装
  10. DELL R410升级网卡驱动