![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
前两天看到村里有高人讨论PHP+COM的,小弟也尝试了一下,结果总是显示说在7与13行“无法打开宏储存。”(代码中用///////无法打开宏存储来表示)
代码如下:
<?php
$input = "e:\\haha\\test.doc";
$word = @new COM("word.application") or die("Unable to instantiate Word");
print "Loaded Word, version {$word->Version}\n
";
$word->Visible = 1;
print "Set Word To Visible
";
$word->Documents->Open($input); ///////无法打开宏存储
print "Opened $input
";
$word->Activate;
print "Activated Word
";
print "Editing Fields
";
$Field = $word->ActiveDocument->Fields(1); /////////////无法打开宏存储
$fieldData = $Field->Result;
$fieldData->Text = "Testing";
// Print the document.
$word->Printout();
// closing word
$word->Quit();
// free the object
$word->Release();
$word = null;
?>
程序应该没有问题,是从网上直接copy的,我的php.ini中关于COM的部分都是true,版本是4.3.4(win),请大家看看是什么问题?
小弟在这里谢谢先!

