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

Free Support Forum - aspose.com

How to highlight text between words?

Can any one please tell me how to add color between the text.

I have the code like below mentioned. That should be display in single line but “content” should be in different color.
builder.Write(“Header content”);

Please help me on this.


Please check the following code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Write("Starting ");

builder.Font.Color = Color.Red;
builder.Write("word1 ");
builder.Font.Color = Color.Green;
builder.Write("more words ");
builder.Font.Color = Color.Red;
builder.Write("word2' ");


builder.Write("Second line ");


Also, please check how to specify formatting on different elements.