J
Jason Reichenbach
I am operating Word 2003 from a C#.NET app, and am having trouble keeping
Word from showing up on the screen.
Here is the code in question:
Word.ApplicationClass Wrd = new Word.ApplicationClass ();
Wrd.Visible = false;
Now at this point, Word is open and indeed invisible. No problem so far.
However, then I open a document:
Word.Document TheDoc;
TheDoc = Wrd.Documents.Open ( ref fileIn, // File to open
ref NotUsed, // ConfirmConversions
ref ReadOnly, // Open Read Only
ref NotUsed, // AddToRecentFiles
ref NotUsed, // PasswordDocument
ref NotUsed, // PasswordTemplate
ref NotUsed, // Revert
ref NotUsed, // WritePasswordDocument
ref NotUsed, // WritePasswordTemplate
ref NotUsed, // Format
ref NotUsed, // Encoding
ref Visible, // Set Invisible
ref NotUsed, // OpenAndRepair
ref NotUsed, // DocumentDirection
ref NotUsed, // NoEncodingDialog
ref NotUsed); // XMLTransform
All the 'NotUsed' items are an object set to the equivalent of null.
Visible is an object set to false.
ReadOnly is an object set to true.
The document opens, and opens read-only, but it opens visible, and stays
that way until I make the call:
TheDoc.Windows.Application.Visible = false;
This makes the window disappear, but by then it is too late; it has flashed
on the screen, much to the annoyance of the user.
What am I missing here?
Word from showing up on the screen.
Here is the code in question:
Word.ApplicationClass Wrd = new Word.ApplicationClass ();
Wrd.Visible = false;
Now at this point, Word is open and indeed invisible. No problem so far.
However, then I open a document:
Word.Document TheDoc;
TheDoc = Wrd.Documents.Open ( ref fileIn, // File to open
ref NotUsed, // ConfirmConversions
ref ReadOnly, // Open Read Only
ref NotUsed, // AddToRecentFiles
ref NotUsed, // PasswordDocument
ref NotUsed, // PasswordTemplate
ref NotUsed, // Revert
ref NotUsed, // WritePasswordDocument
ref NotUsed, // WritePasswordTemplate
ref NotUsed, // Format
ref NotUsed, // Encoding
ref Visible, // Set Invisible
ref NotUsed, // OpenAndRepair
ref NotUsed, // DocumentDirection
ref NotUsed, // NoEncodingDialog
ref NotUsed); // XMLTransform
All the 'NotUsed' items are an object set to the equivalent of null.
Visible is an object set to false.
ReadOnly is an object set to true.
The document opens, and opens read-only, but it opens visible, and stays
that way until I make the call:
TheDoc.Windows.Application.Visible = false;
This makes the window disappear, but by then it is too late; it has flashed
on the screen, much to the annoyance of the user.
What am I missing here?