这是我的代码
$filename = "E:\www.doc";
if(file_exists($filename)) {
// 建立一个指向新COM组件的索引
$word = new COM('word.application') or die("Can't start Word!");
$word->Visible = 1;
$word->Documents->OPen($filename);
$test= $word->ActiveDocument->content->Text;
echo $test;
$word->Documents->Add();
$word->Selection->TypeText($test);
$word->Documents[1]->SaveAs($filename);
$word->Quit(); } else {
echo "file is not exists";
}
错误信息是
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `word.application': 存储空间不足,无法处理此命令。 ' in D:\project\apache\htdocs\dc\test1.php:5 Stack trace: #0 D:\project\apache\htdocs\dc\test1.php(5): com->com('word.applicatio...') #1 {main} thrown in D:\project\apache\htdocs\dc\test1.php on line 5
$filename = "E:\www.doc";
if(file_exists($filename)) {
// 建立一个指向新COM组件的索引
$word = new COM('word.application') or die("Can't start Word!");
$word->Visible = 1;
$word->Documents->OPen($filename);
$test= $word->ActiveDocument->content->Text;
echo $test;
$word->Documents->Add();
$word->Selection->TypeText($test);
$word->Documents[1]->SaveAs($filename);
$word->Quit(); } else {
echo "file is not exists";
}
错误信息是
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `word.application': 存储空间不足,无法处理此命令。 ' in D:\project\apache\htdocs\dc\test1.php:5 Stack trace: #0 D:\project\apache\htdocs\dc\test1.php(5): com->com('word.applicatio...') #1 {main} thrown in D:\project\apache\htdocs\dc\test1.php on line 5
很奇怪的