Word automation different when hidden or not hidden

C

Claus Nielsen

Hello everyone

I'm almost a happy man, because I managed to automate Word to the fullest
using C# and .NET. There has been some trouble along the way, I admit that,
but now it's the worst.

I'm using Word an Excel to create a report from an analysis, so I've created
a template for Word to open. When automation begins, it inserts tables a
various bookmarks. This is where the problem happens, because the first two
tables are different in width then the rest of the tables.
The weird part is that it only happens when I set Word to be hidden, which
is the only option for my server, when it runs as a service.

This is the error picture:
http://www.daimi.au.dk/~cln/errorPicture.JPG

And this is the correct way its supposed to display:
http://www.daimi.au.dk/~cln/correctPicture.JPG

As said, the problem only happens when word is not visible:
---------------------------------------
object fileName = strFileName; (a parameter of the function)
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
oDoc = oWordApplic.Documents.Open(ref fileName, ref missing, ref readOnly,
ref missing, ref missing, ref missing, ref missing, ref missing, ref
missing,
ref missing, ref missing, ref isVisible,ref missing,ref missing,ref missing,
ref missing);
oDoc.Activate();
---------------------------------------

It's the isVisible attribute, that enables or disables the error. But when
the service wants to start Word on the server, it fucks with the tables...

Can anybody help?

Thank you!

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top