Word COM objects

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Word COM objects

Post 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
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post 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
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

word

Post 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
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

nope

Post by Burrito »

Nope,

they need to be able to manipulate the documents and most people don't own a full blown version of acrobat.
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post 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
Post Reply