public string readContent(string path) { try { IDataObject Data1; Word.Application wordApplication = new Word.Application(); wordApplication.Visible = false; Word.Document wordDocument = new Word.Document(); wordDocument = wordApplication.Documents.Open(path); //alles auswählen wordDocument.ActiveWindow.Selection.WholeStory(); //kopieren wordDocument.ActiveWindow.Selection.Copy(); Data1 = Clipboard.GetDataObject(); String str = Data1.GetData(DataFormats.Text).ToString(); //Word Document und Anwendung schließen wordDocument.Close(); wordApplication.Quit(); return(str); } catch (Exception ex) { Console.WriteLine("Error reading docx file: " + ex.ToString()); return("ERROR"); } }