We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to get document text withiout control stuff using C#

Extracting text from the attached file seems to include some control stuff that is not part of the text. My code in C# is simple but perhaps there is a better way?

License l = new License();
l.SetLicense(lic);
Document doc = new Document(wfile);
text = doc.Range.Text;

File:
20200131 130130 Attachment 0131.zip (46.1 KB)

This is the beginning of the extracted text:

20/01/31 - TSX Venture Exchange Stock Maintenance Bulletins

TSX VENTURE COMPANIES

MERGEFIELD COMPANY_NAME_CAPS * MERGEFORMAT BOLD VENTURES INC. (" MERGEFIELD SYMBOL * MERGEFORMAT BOL ")
BULLETIN TYPE: MERGEFIELD “SUB TYPE DESC” * MERGEFORMAT Consolidation
BULLETIN DATE: MERGEFIELD TODAYS_DATE * MERGEFORMAT January 31, 2020
MERGEFIELD TIER_TEXT * MERGEFORMAT TSX Venture Tier 2 Company

@randallg

Please use Node.ToString as shown below to get the desired output. Hope this helps you.

Document doc = new Document(MyDir + "20200131 130130 Attachment 0131.doc");
Console.WriteLine(doc.ToString(SaveFormat.Text));

Thanks very much, that works as expected.

@randallg

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.