PDA

View Full Version : Using COM


callaght
02-01-2004, 08:57 PM
Dear All,

After trying to come to grips with using the COM interface in PHP to open a Word Template on a client machine, I now realise - code running on a server can't open a Word template, using COM, on a client machine by clicking on a hyperlink.

So the next approach I'm taking is:-
1. User on a client machine, clicks on a hyperlink
2. PHP opens a Word template, using COM, on the server
3. PHP inserts some data into the template through COM, on the server
4. PHP saves as a document, on the server
5. User on the client machine is given a hyperlink to download and open the newly created file.

My question is: Does this seem like a good approach or is it ineffiecient? I`ve heard that using COM eats up a lot of resources on a server. And, can anyone point me to some good web addresses that cover this kind of thing?

Many thanks in advance,
Tom

firepages
02-02-2004, 02:14 PM
you can do exactly what you describe , but unless you really need all the word functionality try saving your word template as an RTF , then open the RTF in a text editor , you can see then how you can use the RTF as a regular template , do some str_replace()ments and add a .doc extension for downloading , word will preserve the limited formatting availabe to RTF documents.

phparchitect had a great COM toot in one of its issues but you need to subscribe to get it.