473,396 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

COM and MSWord Automation

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?

(one example can be at http://netevil.org/)

Thanks
Rob
Sep 2 '08 #1
5 1507

<ro*******@vodafone.itwrote in message
news:c5**********************************@k7g2000h sd.googlegroups.com...
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?
Sep 2 '08 #2
On 2 Set, 14:46, "Dale" <the....@example.comwrote:
<rob02o...@vodafone.itwrote in message

news:c5**********************************@k7g2000h sd.googlegroups.com...
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!
Rob
Sep 2 '08 #3

<ro*******@vodafone.itwrote in message
news:8b**********************************@l42g2000 hsc.googlegroups.com...
On 2 Set, 14:46, "Dale" <the....@example.comwrote:
><rob02o...@vodafone.itwrote in message

news:c5**********************************@k7g2000 hsd.googlegroups.com...
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.
Sep 2 '08 #4
On 2 Set, 17:52, "Dale" <the....@example.comwrote:
<rob02o...@vodafone.itwrote in message

news:8b**********************************@l42g2000 hsc.googlegroups.com...
On 2 Set, 14:46, "Dale" <the....@example.comwrote:
<rob02o...@vodafone.itwrote in message
>news:c5**********************************@k7g2000 hsd.googlegroups.com...
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!
Rob
Sep 2 '08 #5

<ro*******@vodafone.itwrote in message
news:b8**********************************@z66g2000 hsc.googlegroups.com...
On 2 Set, 17:52, "Dale" <the....@example.comwrote:
><rob02o...@vodafone.itwrote in message

news:8b**********************************@l42g200 0hsc.googlegroups.com...
On 2 Set, 14:46, "Dale" <the....@example.comwrote:
<rob02o...@vodafone.itwrote in message
>>news:c5**********************************@k7g200 0hsd.googlegroups.com...
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.
Sep 2 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tom Gao | last post by:
hi guys I'm trying to export an aspx page to msword. ############# I know you can do Response.Clear(); Response.ContentType="application/msword";
1
by: Jakub Gutkowski | last post by:
Hi I've got a really laborious task at my work. I have to write documentatio to my C# code in MS Word till Wednesday. They don't care that, documentatio already exist in MSDN format generated by...
4
by: Robert | last post by:
Hello, I would like to take the data from a query and export it to an MSWord doc or dot that can display the fields. (Auto fill) I have been trying to figure out how to do this, but have not...
7
by: lkr | last post by:
hi is there is anyway to capture the document events of a MSWord?eg:I have to handle the event awhen WM_KEYUP or anyother events will occur. give me a solution............ thanks in advance lkr
1
by: Jason Huang | last post by:
Hi, To make it short, how do we do the data extraction to MSWord using ASP.Net C#? Any help will be appreciated. Jason
6
by: Peter | last post by:
I have to write a ASP.NET application that creates MSWord document from a template and populated with data from the webpage. (Templates can reside on the server or client's hard drive.) What is...
5
by: Stephen R. Gibson | last post by:
Is there some way to stream only the body of a Word document (.doc), without all the hidden information, such as the gobbledygook at the top and document prroperties?
1
by: Matt Curreri | last post by:
I'm trying to automate the creation of a MSWord document with C#; however, when I start creating the MSWord document, I occassionly have a MSWord dialog box displaying a warning of low memory and...
8
by: Christiano | last post by:
Hey there... i've developed an asp.net app where you upload a .DOC file and the application converts it into .html. In my development environment everything worked fine, but when i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.