when multiple word objects are running

  • Thread starter Thread starter philipl
  • Start date Start date
P

philipl

hi,

I have a program which waits for batches documents to be dropped into
a folder, once this happens, a class which activates the word object
is instaniated per batchg of docs & a number of things such as
spellchecking grammer checking etc are done. When one batch(containing
one or more docs) is dropped in, everything works fine, but when
multple batches are dropped in(ie many classes of the same class are
instaniated, weird things starts to happen. For example it complains
about custom dictionary not available, or exceptions are generated
when the ends of arraylists are reached.

Does anyone know why this is happening & what I can do to solve this?

thx
-Philip
 
I have a program which waits for batches documents to be dropped into
a folder, once this happens, a class which activates the word object
is instaniated per batchg of docs & a number of things such as
spellchecking grammer checking etc are done. When one batch(containing
one or more docs) is dropped in, everything works fine, but when
multple batches are dropped in(ie many classes of the same class are
instaniated, weird things starts to happen. For example it complains
about custom dictionary not available, or exceptions are generated
when the ends of arraylists are reached.

Hi,

Is this program running as a service, or is it on an interactive desktop?
Office is not supported in server / service scenarios.

How do you connect to the Word object? Do you create a new instance, or try
to attach to a running instance? I imagine that you are creating multiple
WinWord processes and they are having problems accessing shared resources
because they're not really designed to be automated from two places at once.

Can you modify your code to ensure that only one instance of Word is ever
started up? Also if you are creating threads to handle each document or
other tricky things like that then Word will get upset at you.

Peter
 
Peter Torr \(MS\) said:
Hi,

Is this program running as a service, or is it on an interactive desktop?
Office is not supported in server / service scenarios.

How do you connect to the Word object? Do you create a new instance, or try
to attach to a running instance? I imagine that you are creating multiple
WinWord processes and they are having problems accessing shared resources
because they're not really designed to be automated from two places at once.

Can you modify your code to ensure that only one instance of Word is ever
started up? Also if you are creating threads to handle each document or
other tricky things like that then Word will get upset at you.

Peter


Hi Peter,

I presume it's a service scenaro, as no interaction is expected.

I create an instance of the word object per batch of documents. Must I
process all these documents sequentially? Is there no way I can
multitask this?

thx
-Philip
 
I create an instance of the word object per batch of documents. Must I
process all these documents sequentially? Is there no way I can
multitask this?

No, you can only call into the Word OM on the main thread (and any calls
from other threads will be marshalled to the main thread).

Peter
 
Back
Top