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

Free Support Forum - aspose.com

Infinite loop Issue

Hello,
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 (22.5.0.0) 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);