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;
http://support.microsoft.com/kb/257757
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
http://freeword.codeplex.com/
Document document = new Document();
document.LoadFromFile("test.doct");
first add the dll of office.interop by adding directly to the resources then add this using directive:
using Microsoft.Office.Interop.Word;
and use the following code
Application ap = new Application();
Document document = ap.Documents.Open(@"C:\invoice.docx");;
You need to make sure that the Word application window actually is made visible when automating Word like that:
var applicationWord = new Microsoft.Office.Interop.Word.Application();
applicationWord.Visible = true;