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

Free Support Forum - aspose.com

Replacing one style wtih another in a document

Is there example code available that shows how to replace a style in a document with another style?
For example, if I have a document that uses StyleA in 10 places, I want to change all of those places to use StyleB.

Thank you for your inquiry.
You can select all descendant nodes of the same type with this Dcoument.GetChildNodes method:
Also you can select all the nodes satisfying some common criteria with Document.SelectNodes method:
I’m not sure style criterion is supported so it’s better to use the first one.
After you have selected the nodes of class Paragraph or Run depending on the style type you can change that style to some another in the simple foreach loop.