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

Free Support Forum - aspose.com

Changing Font with DocumentBuilder from within a replace evaluator

Hello,


I’m using the Replace method on a Range to identify text within a word document to be replaced. Part of the replacement is that I need to set the Font to bold and Underlined. I’m attempting to use the DocumentBuilder on the MatchNode and set the font settings from there, however my updates don’t seem to be effecting the resulting text. Can you please tell me the correct way to achieve this.

David

DocumentBuilder builder = new DocumentBuilder(e.MatchNode.Document);
builder.MoveTo(e.MatchNode);
builder.Font.Underline = Underline.Dash;
builder.Font.Bold = true;
e.Replacement = this.tag.Value;

Hi David,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I think, you can try using the same technique as demonstrated here:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/howto-find-and-highlight-text.html

Hope this helps.

Best regards.