Re: COM and MSWord Automation




<rob02omni@xxxxxxxxxxx> wrote in message
news:b8a3cd5d-0d83-46de-ab15-15d1efcb35f7@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 2 Set, 17:52, "Dale" <the....@xxxxxxxxxxx> wrote:
<rob02o...@xxxxxxxxxxx> wrote in message

news:8bfb8181-0d1d-481f-b97e-9475595641a5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



On 2 Set, 14:46, "Dale" <the....@xxxxxxxxxxx> wrote:
<rob02o...@xxxxxxxxxxx> wrote in message

news:c5a925d0-8629-404e-9d01-296c56ec3d74@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hi there!
I'm trying to automate MSWord in the server side.

For limiting memory usage i'm writing code to make a unique instance
of winword and then calling it from the php page i need.

So far i've used the sleep() function to keep alive the winword
instance but i think it would be better to use com_message_pump and
com_event_sink to take care of the winword process.

Alas when i try the code with com_event_sink function winword get
stuck?

Anyone has already tried something similar and/or has good example
of
a winword daemon or similar?

uhmmm, 'daemon'? winword? you are mixing linux and windows terms.
what's
your config? are you running php on linux and creating the word
instance
on
a remote windows server, or are you running everything on the same
pc/server - a windows server?

you do realize that php may or may not be running in the same process
thread
each time an http request is made, right? are you familiar with
cross-process development in windows?

Hi and thanks for the reply.
Well i'm in a win32 server box, and as 'daemon' yes i was meaning a
service (or something like act as it).
I need to make mailmerge (i know of xml classes but i cant do this
because template are manipulated in clients) on the server and i have
realized that using multiple instance of winword will be a wast of
system resources (CPU, memory...).
What i want to accomplish is to have a php script running the COM
winword instance (for a period ie sleeping for accomplish tasks) and
making call with com_get_active_object.
I was thinking that the best practice would be to use com_message_pump
but i'm not really sure about this?
Thanks!

you realize that sharing the *same* instance is going to lead to
problems,
right? it is no more a waste of resources to instanciate a new word
object
than it is to share a single instance across processes, right? further,
it
will save you a headache down the road.

have you thought of simply using xml with the ms workup? save your master
document as xml. close the xml doc. reopen it with word. no difference in
appearance, right? all you have to do is open the xml doc in notepad, or
whatever, and use what you see there as your programmatic guide.

I will do some test in inizializing some intances of winword, in fact
the process of do a mailmerge is pretty fast something like 2 minute
each...
It's a good point to think about xml! i just tried to save as docx and
then unzipped... seems a lot to work to get into but i like the idea
(in fact i'm doing xls with PHPExcel and work like a charm)...
Thanks a lot for yours suggestions! A good thread!


not a problem. best wishes.


.



Relevant Pages

  • Re: REST client sample
    ... > I've got some data that I want to upload to the server. ... POST and turning XML data into appropriate ST objects. ... Ok, seeing as you're working with a PHP server, it's probably best to keep ... XmlRpc client I ported in Dolphin.. ...
    (comp.lang.smalltalk.dolphin)
  • Re: COM and MSWord Automation
    ... I'm trying to automate MSWord in the server side. ... of winword and then calling it from the php page i need. ... a remote windows server, or are you running everything on the same ...
    (comp.lang.php)
  • Re: xmlhttprequest to get dynamically generated data seems to have a size limit
    ... > server side using xmlhttprequest. ... > but if the data (xml or text) is generated dynamically using php, ... I've served dynamic content over 600K in size, this was using C, not PHP. ...
    (comp.lang.javascript)
  • Re: OT: Apache, PHP & SimpleXML
    ... third party, however they give me a "XML not well formed" error. ... I then did a CURL from the server itself, ... Just thinking that if PHP can't even see the file's existence, ...
    (uk.rec.motorcycles)
  • Re: Why PHP?
    ... > Try parsing and building an XML document natively in FC. ... Also, PHP is ... > a server module that runs in parallel with Apache. ... everything I need to in PickBasic on the database/application server, ...
    (comp.databases.pick)