开发者

Cannot open COM using php

I am trying to read contents of word file. when i run this script on localhost i hear a beep and the page keeps loading and nothing happens. Do i need to make changes in php.ini or somewhere else to make COM work

$word = new COM("word.application") or die ("Could not initialise MS Word object.");

$word->Documents->Open(realpath("test.doc"));

// Extract content.

$content =(string) $开发者_开发知识库word->ActiveDocument->Content;

echo $content;

$word->ActiveDocument->Close(false);

$word->Quit(); $word = null; unset($word);


when i run this script on localhost i hear a beep

That's probably the Word.Application object encountering an error. Guess you should stop doing what you're doing and try something else:

Considerations for server-side Automation of Office

...

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜