Inserting Line Breaks with .Replace() method

Hi there everybody,
I’m cannot find how to insert Line Breaks with the .Replace() method of the Document.Range class.
For example, I have a .dot model document containing the string “\n” several times. I open it with the following code:

Dim doc As Aspose.Words.Document = New Aspose.Words.Document(“MyDoc.dot”)

Then as said I wish to replace the “\n” instances by a Line Break:

doc.Range.Replace("\n", BreakType.LineBreak, False, False)

But it does nothing… What does I have missed?

Hi

Thanks for your inquiry. Could you please attach your input document here for testing? I will check the problems on my side and provide you more information.

Best regards,

Hi AndreyN,
There is a sample of doc in attachement.
Thanks in advance.

Hi

Thank you for additional information. Please try using the following code:
Dim doc As New Document(“sample_aspose.dot”)
doc.Range.Replace("\n", ControlChar.LineBreak, False, False)
doc.Save(“out.doc”)

Best regards,

Hi,
Thank you so very much, it works great! :slight_smile:
Thank you for your reactivity. See you soon.
yoyoo