龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

关于php的com组件问题

时间:2014-07-22 14:48来源: 作者: 点击:
分享到:
本人写的代码如下?php $word=new COM(word.application) or die(have a error); // echo $word-Version; $word-Visible=1; $word-Documents-Add(); $word-Selection-TypeText(this is test.........); $word-Documents[1]-SaveAs(test.doc); $word-Qui
本人写的代码如下

<?php

$word=new COM("word.application") or die("have a error");

// echo $word->Version;
$word->Visible=1;
$word->Documents->Add();

$word->Selection->TypeText("this is test.........");

$word->Documents[1]->SaveAs("test.doc");

$word->Quit();

$word=null;

?>

出现错误如下:

 
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Word<br/><b>Description:</b> 命令失败' in G:\mysql\apache\htdocs\playecshop\com.php:11 Stack trace: #0 G:\mysql\apache\htdocs\playecshop\com.php(11): variant->SaveAs('test.doc') #1 {main} thrown inG:\mysql\apache\htdocs\playecshop\com.php on line 11

是什么原因:求高手指导
<?php
  
  $word=new COM("word.application") or die("have a error");
  
 // echo $word->Version;
 $word->Visible=1;
  $word->Documents->Add();

  $word->Selection->TypeText("this is test.........");

  $word->Documents[1]->SaveAs("test.doc");
  
  $word->Quit();

  $word=null;

?>

出现错误如下:

 
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Word<br/><b>Description:</b> 命令失败' in G:\mysql\apache\htdocs\playecshop\com.php:11 Stack trace: #0 G:\mysql\apache\htdocs\playecshop\com.php(11): variant->SaveAs('test.doc') #1 {main} thrown inG:\mysql\apache\htdocs\playecshop\com.php on line 11

是什么原因:求高手指导
精彩图集

赞助商链接