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

Free Support Forum - aspose.com

Replacing text phrases in html with formatting


We own a Site Developer license to Aspose.Words and I am trying to replace text in html documents regardless of the html structure the text is in or rather the markup that is used in the phrase.

For example:
I have this html:

The sad truth about it is that Johnny didn't like spinach.

I want to replace the string: “The sad truth about it is that Johnny didn’t like spinach.” with “The horrible truth about it is that Joe didn’t like spinach.”

So resulting replacement would look like this:

The horrible truth about it is Joe didn't like spinach.

So it finds the whole phrase in the HTML regardless of the html that is in the phrase and replaces it. Is this something that Aspose.Words can do? If so could you point me to a code snippet? I have look at some of the custom evaluators and none seem to do this.

John Lewis


You will be able to achieve this by using the ‘Find and Replace’ functionality of Aspose.Words. Please refer to the following article for more details:
Find and Replace by using Aspose.Words