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!

 

 

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.