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

Free Support Forum - aspose.com

Get paragraph text without deletions

When calling Paragraph.GetText(), the string retrieved includes any text deletions as well. That is, if text has been deleted with Track Changes, it will nevertheless appear as full text within the string.

I am aware that it is possible to loop across all Runs in the paragraph, querying each one with IsDeleteRevision(), and then concatenating all of the runs into a single string. That would solve the problem, but it seems somewhat cumbersome, and probably time consuming as well.

Is there any way to set a flag or the like to indicate that Paragraph.GetText() should ignore deleted text when returning the text of the paragraph?

Hi Avi,

Thanks for your query. In your case, you can use Document.AcceptAllRevisions method and then get the text of Paragraphs. Please check the following code snippet. Hope this answers your query. Please let us know if you have any more quereis.

Document doc = new Document(MyDir +"in.doc");

doc.AcceptAllRevisions();

foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))

{

Console.Write(para.GetText());

}


A post was split to a new topic: Get text without call of Document.AcceptAllRevision