Get text without track changes

Hi team,

Is there a way to extract text without track changes when applying multiple rules?

Because whenever I give doc.GetText() I will get data with deleted content also. How can we achieve this?

@kkumaranil485 To get the final content of the document, you should accept all revision before extracting text from the document. For example see the following code:

Document doc = new Document(@"C:\Temp\in.docx");
doc.AcceptAllRevisions();
Console.WriteLine(doc.ToString(SaveFormat.Text).Trim());

In the example Document.ToString method is used, because Document.GetText method also includes control characters into the returned string, like field’s special characters.

Hi @alexey.noskov,

For my scenario, I don’t want to accept tract revisions. Without accepting or rejecting can we get?

@kkumaranil485 You can implement your own method to get text, for example using DocumentVisitor and skip Run nodes that has IsDeleteRevision flag set.