I have the path to my file and I just want to get the text from the file and assign in to a string.How can I do that?
The link you provided is not working . Can you provide another link to extract Text content from a Word Document using c#
- Use Document.Save with SaveFormat.Text to save as plain text into a file or stream.
- Use Node.ToString and pass the SaveFormat.Text parameter. Internally, this invokes save as text into a memory stream and returns the resulting string.
- Use Node.GetText to retrieve text with all Microsoft Word control characters including field codes.
- Implement a custom DocumentVisitor to perform customized extraction.
Document doc = new Document(MyDir + @“in.docx”);<o:p></o:p>
TxtSaveOptions opts = new TxtSaveOptions();
doc.Save(MyDir + @"out.txt", opts);