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

Free Support Forum - aspose.com

Replacing multiple occurrences of |_|

Hi,


I needed to know if there is a way to replace multiple occurrences of || with TEXT.

Ex:

I have a document that has the following lines:

Hi |||||
How are you |||

I need to replace both the instances (|||||, ||_|) with TEXT

Hello

Thanks for your request. I think in your case you can try using Replace method. Please see the following link to learn more:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.range.replace_overloads.html

Also please see the following simple code:

Document doc = new Document("C:\\Temp\\in.docx");

doc.Range.Replace("|_|_|_|_|", "Andrey", false, false);

// Save output document.

doc.Save("C:\\Temp\\out.docx");

The input and the output documents are attached.

Best regards,