I'm trying to open .doc file and read its content. But i can't find any way how to do this without launching MSWord.
Now I have following code:
Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
object nullObject = System.Reflection.Missing.Value;
object file = @"C:\doc.doc";
Microsoft.Office.Interop.Word.Document doc = app.Documents.Open(ref file, ref nullObject, ref nullObject,
ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject,
ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject,
ref nullObject);
doc.ActiveWindow.Selection.WholeStory();
doc.ActiveWindow.Selection.Copy();
IDataObject data = Clipboard.GetDataObject();
string text = data.GetData(DataFormats.Text).ToString();
doc.Close(ref nullObject, ref nullObject, ref nullObject);
app.Quit(ref nullObject, ref nullObject, ref nullObject);
But it launches MSWord, any solution to do it without launching? Thanks in advance.