Hi Friends,
I need to open a word document in C# for write.
The problem i have is, the doc is always open as read only. Why is that? And i need to call the open method twice to open the doc.
And the other problem is even i close the application the task manager shows the "winword.exe" process is still running.. I cant use the Application.Quit
method in the finally close then it will not open the doc.. i dunt have any idea where should i place the Applicaton.Quit method..
here is the code i used..
string fileName = @"\\myserver\test\test.doc";
Microsoft.Office.Interop.Word.ApplicationClass wordapp = new Microsoft.Office.Interop.Word.ApplicationClass();
object path = fileName;
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
try
{
wordapp.Documents.Open(ref path,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);
}
finally{
//wordapp.Documents.Close(ref missing, ref missing, ref missing);
//wordapp.Application.Quit(ref missing, ref missing, ref missing);
}
Please help me....