Infinite loop Issue

During download the report getting below issue.

System.InvalidOperationException: Infinite loop detected.     at   .(Int32 )     at   .(Boolean )     at   .(Boolean )     at   . ()     at    .(Document ,     )     at    .     ()     at    .(    )     at    .(    ,     )     at    .(Node ,     )     at Aspose.Words.Document.UpdateFields()     at

And After updating the version of Aspose.Words ( we can not use below code

to replace the text with html. So please suggest me that how can find text and replace with html.

@RiteshK10 You should use IReplacingCallback and FindReplaceOptions.ReplacingCallback.
Your code should like like this:

FindReplaceOptions options = new FindReplaceOptions();
options.ReplacingCallback = new FindAndInsertHtml(@"<span>New text</span>");
doc.Range.Replace(new Regex(@"ReplaceText"), "", options);