我想在我的应用程序中打开几个文档,但是这样做时,Word 总是打开主窗口。我怎样才能防止这种情况发生?
我已经将应用程序和文档的可见性设置为false
,但是当我启动程序时它仍然打开。
private static readonly Application word = new Application();
[...]
FileInfo fileInfo = (FileInfo)file;
object filename = fileInfo.FullName;
object confirmConversion = false;
object readOnly = true;
object visible = false;
object skipEncodingDialog = true;
object save = false;
word.Visible = false;
Document srcDoc = word.Documents.Open(ref filename, ref confirmConversion, ref readOnly, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref visible,
ref missing, ref missing, ref skipEncodingDialog, ref missing);