Jump to content

Problem with opening .doc with php using COM


WillyTheFish

Recommended Posts

Hey guys,

 

I've been searching the forum, but haven't found a post describing the following problem:

I want to Open and Manipulate a word document using the COM class. This is my code so far:

 

$Wrd = new COM("Word.Application");
$DocName = TEMPLATE_DIR.'template.doc';
$Wrd->Application->Visible = True;
$WrdDoc = $Wrd->Documents->Open(realpath($DocName));

# do something here

$WrdDoc->SaveAs(realpath($DocName));
$Wrd->ActiveDocument->Close(false);
$Wrd->Quit();	
$Wrd = NULL;

 

There's no problem creating the COM-object, but when i try

$WrdDoc = $Wrd->Documents->Open(realpath($DocName));

the browser is either complaining about insufficient memory or will chew on the code for ages...

I can see that a temporary word file is created, so it seems that the document has been opened... still, the browser is working and working....

 

can anyone tell me what's going on?

Many Thanks!

 

 

 

yeah it's me again....

 

now I downloaded and tried this script/class and left it unchanged... still doesn't work:

http://www.phpclasses.org/package/3553-PHP-Edit-Microsoft-Word-documents-using-COM-objects.html

 

there must be something wrong with my php-settings or my ms Word installation i guess?

COM is enabled in phpinfo()!

 

Any suggestions....? I really need to get this to work :(

thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.