Document.Range.Replace function throws runtime error "Object reference not set to an instance of an object"

Hi,
I have an issue with Document.Range.Replace function. It gives an exception “Object reference not set to an instance of an object” for a regular expression “\f” ( to find the form section/page breaks in a document). Please find the code below.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("This is a test document to validate Section Breaks.");
builder.Write(ControlChar.SectionBreak);
builder.Write("End of the documnent.");
doc.Range.Replace(r, this, true);
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("This is a test document to validate Page Breaks.");
builder.Write(ControlChar.SectionBreak);
builder.Write("End of the documnent.");
doc.Range.Replace(new Regex("\f"), this, true); // runtime error here

Please help me.
Thanks.

Hi
Thanks for your request. The problem occur because you cannot use special characters in a captured or replacement string. Please see the documentation for more details:
https://reference.aspose.com/words/net/aspose.words/range/replace/
Your request has been linked to the appropriate issue. We will let you know once this is supported.
Best regards,

The issues you have found earlier (filed as WORDSNET-1252) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(3)

The issues you have found earlier (filed as WORDSNET-1252) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(2)