Not getting a proper text from the ms document file

Not getting Proper text

Aspose.Words.Document document= new Aspose.Words.Document(@"filePath");
document.GetText();

Text and doc file are attached

Text file contains formating tags.zip (825.7 KB)

@hemalp You should use Document.ToString method:

Document doc = new Document(@"C:\Temp\in.doc");
string txt = doc.ToString(SaveFormat.Text);

Or if it is required to convert document to TXT, you can use Document.Save method:

Document doc = new Document(@"C:\Temp\in.doc");
doc.Save(@"C:\Temp\out.txt");

It working properly

thanks for your advice

1 Like