Replace colored text

Hello, we have two questions:

1) In a Word document … How can we find and replace a blue text (for instance, “This is the old blue text”) with a new red text (“This is the new red text”)?

2) In a Word document … How can we find and replace a blue text (for instance, “This is a blue text”) for the full formatted content of another document?

Thank you!

Hi Isidro,


Thanks for your inquiry.

1) If the blue color is applied on text directly, then you can use the code from here to identify those Run nodes and assign a new text value to Run and change their Font’s color as well (see Run.Text and Run.Font.Color Properties)

2) You can identify the blue colored Run nodes and insert a new document as mentioned in the following article:
http://www.aspose.com/docs/display/wordsjava/How+to++Insert+a+Document+into+another+Document

I hope, this helps.

Best regards,