【问题标题】:Word automation issue with PHPPHP 的 Word 自动化问题
【发布时间】:2010-07-30 01:17:28
【问题描述】:

我一直在尝试自动打开和填充网络上的 Word 文件,但在尝试从映射的网络驱动器打开文件时遇到了问题。我可以从我的 c:\ 驱动器打开该文件,并将 Apache 设置更改为作为用户而不是作为本地服务运行。该脚本在 Zend 环境中运行得非常好,做它应该做的一切,但在 Apache 上它读取目标目录但无法使用 COM 打开文件。 (该目录是一个 Linux 网络存储设备,我确实有读/写权限。)

try {
 com_load_typelib('Word.Application');
 $word = new COM("Word.Application") or die ("Can't start Word");
 $word->visible = 1;

 $handle = opendir('\\\\<host ip addy>\\<sharename>\\<directory>');
 echo $handle . "\n";
 while (false !== ($file = readdir($handle))) {
    echo "$file\n";
 }
 $word->Documents->Open("\\\\<host ip addy>\\<sharename>\\<directory>\\test.doc");

 $word->Documents[1]->Close();
 $word->Quit();
 $word=null;
} catch (com_exception $ce) {
    echo $ce->getMessage;
 }

对于解决此问题的任何想法,我将不胜感激。

【问题讨论】:

    标签: php automation ms-word


    【解决方案1】:

    拥有读/写权限,但 Apache 进程有吗?

    您是否收到可重现的错误消息?

    【讨论】:

      【解决方案2】:

      我已将 Apache 设置为作为我昨天失败的帐户运行(在重新启动服务器后),但重新启动我的机器似乎已将其解开并以正确的权限运行所有内容。

      【讨论】:

      • 请不要将答案作为回复发布,请改用 cmets。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-31
      • 2011-12-22
      • 2019-03-29
      相关资源
      最近更新 更多