| View previous topic :: View next topic |
| Author |
Message |
Kittu
Joined: 21 Aug 2007 Posts: 67
|
Posted: Tue Jun 23, 2009 7:01 am Post subject: winWord process is running, but i can't see the document. |
|
|
Hi experts,
I am developing an application like opening a word document through c# coding. my problem is the word process is running but i can't see the document. here is my code down below.
string Path = @"C:\doc2.doc";
Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
object file = Path;
object nullobj = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
doc.Close(ref nullobj, ref nullobj, ref nullobj);
wordApp.Quit(ref nullobj, ref nullobj, ref nullobj);
Please help me in this issue...it is very urgent....
thanks
kittu |
|
| Back to top |
|
 |
Raghavendra
Joined: 21 Aug 2007 Posts: 215
|
Posted: Tue Jun 30, 2009 3:29 am Post subject: |
|
|
Hello Kittu,
You forgot to place this line of code 'doc.Activate();'. Now place this code and let me know your problem fixes or not.
string Path = @"C:\doc2.doc";
Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
object file = Path;
object nullobj = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
doc.Activate();
doc.Close(ref nullobj, ref nullobj, ref nullobj);
wordApp.Quit(ref nullobj, ref nullobj, ref nullobj);
Bye... |
|
| Back to top |
|
 |
|
|