I want to open a word file saved in my server using "Microsoft.Office.Interop.Word".
This is my code:
object missing = System.Reflection.Missing.Value;
object readOnly = false;
object isVisible = true;
object fileName = "http://localhost:52099/modelloBusta/prova.dotx";
Microsoft.Office.Interop.Word.ApplicationClass applicationWord = new Microsoft.Office.Interop.Word.ApplicationClass();
Microsoft.Office.Interop.Word.Document modelloBusta = new Microsoft.Office.Interop.Word.Document();
try
{
modelloBusta = applicationWord.Documents.Open(ref fileName, 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);
modelloBusta.Activate();
}
catch (COMException eccezione){
Console.Write(eccezione);
modelloBusta.Application.Quit(ref missing, ref missing, ref missing);
}
In the windows task manager the process is present, but the "word document" doesn't appear (the application does not start).
What is the problem?
Thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…