Text highlighting and bulleted lists

I need some help here. I have an application that is dynamically constructing text from a database, and some text can be highlighted with a background color, and some can be in a bulleted list. I’m using a document builder object to construct the text, and I’m able to use the Font.HighlightColor property to turn the background color on and off. I’m toggling the bullet list on and off using ListFormat.ApplyBulletDefault() and ListFormat.RemoveNumbers().

My problem comes when a section is to be both highlighted and bulleted. I’m turning on the highlight before turnning on the bullet, but I still get a stair-step affect on the first item of the list where the bullet is on a white background and the highlight starts at the text. On the second and subsequent list items, the bullet and intervening white space is highlighted. (I’d illustrate, but it doesn’t look like the formatting on this allows highlighting.)

Any suggestions?

Hi
Thanks for your inquiry. I think you can resolve this problem by setting highlighting of ParagraphBreakFont as shown in the following code.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Font.HighlightColor = Color.Red;
builder.CurrentParagraph.ParagraphBreakFont.HighlightColor = Color.Red;
builder.ListFormat.ApplyBulletDefault();
for (int i = 0; i < 10; i++)
{
    builder.Writeln("test");
}
builder.Write("test");
doc.Save(@"Test157\out.doc");

Hope this helps.
Best regards.

That did the job, Alexey. Thank you.