Page 1 of 1

Word COM objects

Posted: Mon Feb 16, 2004 12:27 pm
by Burrito
Hello, on Friday I posted a question about how to dynamically create word documents using PHP. I have figured out how to open a new word com object and have been able to successfully create my dynamic word documents that way. However, it is very slow as it is opening a new instance of word on the server every time I want to create a new document. What I would like to be able to do is connect to an existing open object and use it to create my documents so that I'm not having to open a new instance of word every time I want to create a new document. I know this can be done because I do it with .asp and .cfm but I can't seem to find any documentation for php on how to do this. I'm amenable to invoking a new instance just for php and connecting to that one (thereby having two instances of word open on the server at any one time). But I cant' seem to figure this out. Ideally, I'd like to use the same instance that I have open for .cfm and .asp.

I've tried:

$objWord = com_load("Word.Application");
$objWord = new COM("Word.Application");

but as I said above, both of those invoke new instances of the word application on the server which causes a significant amount of load time.

does anyone know a way to call the already open instance?

thx,

Burr

Posted: Mon Feb 16, 2004 12:33 pm
by malcolmboston
why not just use notepad (flat filing system) if you need to create diff text colours etc create HTML pages, i personally, cannot see any good reason for integrating word into your scripts

word

Posted: Mon Feb 16, 2004 12:37 pm
by Burrito
I run several web sites that sell documents online. I email them their documents in MS Word format so I DO use html to create the documents with their proper formatting etc. But I need to be able to send them to my customers in MS Word format.

Notepad is not gonna work for my situation.

any other "real" ideas?

thx,

Burr

Posted: Mon Feb 16, 2004 12:40 pm
by malcolmboston

nope

Posted: Mon Feb 16, 2004 12:42 pm
by Burrito
Nope,

they need to be able to manipulate the documents and most people don't own a full blown version of acrobat.

Posted: Mon Feb 16, 2004 12:47 pm
by malcolmboston
the only thing i can suggest, and would personally do, is use html/xml pages,

however as you have stated this is not an option for you :?

sorry