c# - How can I make word visible when opening a document through interop? -


i want open word document through interop , word must visible in process.it looks straight forward because there parameter called "visible in open function on word document. word in background. missing?

static void main(string[] args) {     microsoft.office.interop.word.application word = null;     word = new microsoft.office.interop.word.application();      object inputfile = "c:\\test.docx";     object confirmconversions = false;     object readonly = true;     object visible = true;     object missing = type.missing;      // open document...     microsoft.office.interop.word.document doc = null;     doc = word.documents.open(         ref inputfile, ref confirmconversions, 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 missing, ref missing);     doc.activate();      console.readkey(); } 

hmm. apparantly both application , document has visible. solution add line (before doc.activate() ):

word.visible = true; 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -