创建文档;

<?php
$html = "this is question";
for($i=1;$i<=3;$i++){
$word = new word();
$word->start(); $wordname = 'xxxx'.$i.".doc";
echo $html;
$word->save($wordname);
ob_flush();
flush();
} class word
{
function start()
{
ob_start();
echo '<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">';
}
function save($path)
{ echo "</html>";
$data = ob_get_contents();
ob_end_clean(); $this->wirtefile ($path,$data);
} function wirtefile ($fn,$data)
{
$fp=fopen($fn,"wb");
fwrite($fp,$data);
fclose($fp);
}
}
?>

  读取文档

<?php
$word = new COM("word.application") or die ("Could not initialise MS Word object.");
$word->Documents->Open(realpath("Sample.doc")); // Extract content.
$content = (string) $word->ActiveDocument->Content; echo $content; $word->ActiveDocument->Close(false); $word->Quit();
$word = null;
unset($word);
?>

  

最新文章

  1. celery简单应用
  2. JS &amp;#8203; ZERO WIDTH SPACE
  3. ubuntu多网卡绑定
  4. Android 按钮按下效果
  5. juce中的内存泄漏检测
  6. Ubuntu16.04 server下配置MySQL,并开启远程连接
  7. git 利用分支概念实现一个仓库管理两个项目
  8. 读Zepto源码之集合操作
  9. 一段文字中的几个keyword显示高亮
  10. pat1111-1120
  11. python学习:输出九九乘法表
  12. Wechart 饼图
  13. CPU 利用率背后的真相,只有 1% 人知道【转】
  14. c 时间转移函数
  15. tomcat 修改内存配置
  16. Git Diff 格式分析
  17. MapReduce规约
  18. redis的学习使用(ubuntu系统下)
  19. WPF 自定义命令 以及 命令的启用与禁用
  20. 设置TeeChart的提示文本

热门文章

  1. OSSchedLock()函数透析
  2. 转:基于HTTP协议的轻量级开源简单队列服务:HTTPSQS
  3. 快速替换图片的组合-AE-样片!
  4. javascript content
  5. TinyMCE下载及使用
  6. 【POJ】1816 Wild Words
  7. cscope使用
  8. 数据结构(线段树):BZOJ 1103 [POI2007]大都市meg
  9. 大小中型数据库和Oracle的常用命令
  10. 微软Azure Services Bus中的工作流