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

Free Support Forum - aspose.com

Need Technical Support - Evaluating Product for Purchase

Received : 2007/10/16 23:00:38
Message : I'm evaulating Aspose.Words for .NET in comparison to the TXTextControl library. My preference is to go with Aspose.Word if I can however, I've encountered two issues that I need help with:

1. I noticed that when I use the simple Range.Replace("", "", False, True) method, that it doesn't work if the text I'm trying to replace has "<" or ">" in it. Please help me get past this.

For example, this doesn't work:

DocTextControl.Range.Replace("", "Hello", False, True)

HOwever, something like this does:

DocTextControl.Range.Replace("_test_", "Hello", False, True)

Note these are not merge fields, just text denoted with angle brackets.

The other issue is that I need to know how to change the BackgroundColor of the whole word doc or just a range.

If you help me with these two issues, I'm confident we will purchase a license.

Heath Allen

Vice President of Information Technology
Incorp Services, Inc.

PS. My user name is "heath_inlv" and my email is heath.allen@incorp.com, please get back to me ASAP as we need to make a decision in the next day or two.

This message was posted using Aspose.Live 2 Forum


Thanks for your request.

  1. You can replace this text using the following code.

doc.Range.Replace(new Regex(""), "Hello");

  1. You can change the BackgroundColor of the range using the Shading.BackgroundPatternColor property. See the following code for example.

doc.FirstSection.Body.FirstParagraph.ParagraphFormat.Shading.BackgroundPatternColor = Color.Red;

Also see the following link.

Best regards.


The Regular Expression search worked great, however, the code fragment you gave me for changing the backgroundcolor of the document works, but it actually doesn't change the highlighted text.

If I use the following block, I can change all paragraphs to a special bg color, however, the text in the document that has a highlighted background color does not change and that's what I need to make white.

For Each objParagraph As Aspose.Words.Paragraph In DocTextControl.FirstSection.Body.Paragraphs

objParagraph.ParagraphFormat.Shading.BackgroundPatternColor = Color.Cornsilk


I've attached a copy of one of the word docs that we use, as you can see there are sections of text that have a yellow background highlight color, I need to be able to programatically change these to white.

If you are able to help me solve this, then we can purchase the suite and move this to production as everything else is working great, but we cannot move without this final piece.




Try to use the following code to achieve this.

Document doc = new Document(@"253_98886_heath_inlv\Generic+Letter_No_Letterhead.doc");

NodeCollection runs = doc.GetChildNodes(NodeType.Run, true);

foreach (Run run in runs)


run.Font.HighlightColor = Color.White;



And this code in Visual Basic.

Dim doc As Document = New Document("Generic+Letter_No_Letterhead.doc")

Dim runs As NodeCollection = doc.GetChildNodes(NodeType.Run, True)

Dim run As Run = Nothing

For Each run In runs

run.Font.HighlightColor = System.Drawing.Color.White()



Best regards.

Wow, I'm impressed by the level of support so far, however, I wonder if this same level of support will exist once I purchase a license.

Can you please elaborate?




Thanks for your appreciation. Let me know what else you want to know?

Best regards.

The issues you have found earlier (filed as 3911) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The latest version of Aspose.Words allows getting/setting page color of the document using the appropriate property. Please follow the link to learn more:


Also, it allows getting/setting the background shape of the document:


The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan