Replace text with special characters \n\r

Hi

I want to replace range text but in the replacement I have "\n\r"

I get exception "The replace string cannot contain special or break characters."

I understand, it should be in another paragraph

What can I do instead?

Hi there,


Thanks
for your inquiry. Unfortunately, currently, you cannot use special
character in replacement and captured strings. This is mentioned in the
documentation: “An exception is thrown if a captured or replacement
string contain one or more special characters: paragraph break, cell
break, section break, field start, field separator, field end, inline
picture, drawing object, footnote.

In future we will consider improving Replace method in order to support special characters. Your request has been linked to the appropriate issue (i.e. WORDSNET-1252) in our bug tracking system and you will be notified as soon as it is resolved. Sorry for the inconvenience.

OK,

Please help me to build a workaround
I think to split \n\r and create new paragraph for each item
How can I do that?

Hi there,


Thanks
for your inquiry. In your case, I suggest you please replace ‘\n\r’ with ControlChar.LineBreak. Hope this helps you.


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

doc.Range.Replace("Address", "Address 1" + ControlChar.LineBreak + ControlChar.LineBreak + "Address 2", false, false);


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.
(9)