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

Free Support Forum - aspose.com

ApplyNumberDefault()

I am trying to use DocumentBuilder.ApplyNumberDefault(). The problem I am having is that the very first number is in Times New Roman 12pt. Most likely the default for Normal.dot. All subsequence list items use the appropriate font.

Is there something I am doing wrong? For what its worth, if I write a line of text before the numbered list, the first entry in the numbered list is fine.

void WriteNumberedList(List values, string filename)
{
    DocumentBuilder docBuilder = new DocumentBuilder();
    docBuilder.ParagraphFormat.ClearFormatting();

    docBuilder.Font.Name = "Arial";
    docBuilder.Font.Size = 10.0;

    // docBuilder.Writeln("Test");

    docBuilder.ListFormat.ApplyNumberDefault();

    foreach (string value in values)
    {
        docBuilder.Writeln(value);
    }

    docBuilder.ParagraphFormat.ClearFormatting();

    docBuilder.Document.Save(filename);
}

Hi

Thanks for your inquiry. You can solve the problem by setting ParagraphBreakFont. Please see the following code snippet.

docBuilder.Font.Name = "Arial";
docBuilder.Font.Size = 10.0;
docBuilder.CurrentParagraph.ParagraphBreakFont.Name = "Arial";
docBuilder.CurrentParagraph.ParagraphBreakFont.Size = 10.0;

Hope this could help you.

Best regards.

That did the trick. Thanks!