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

Free Support Forum - aspose.com

How to add heading numbers in word

how to add heading numbers in Word document ?

Hi Gregory,

Thanks for your inquiry. Following code example creates a sample document that exercises all outline headings list templates. Hope this helps you.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Aspose.Words.Lists.List list = doc.Lists.Add(ListTemplate.OutlineHeadingsArticleSection);
AddOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline 1");
list = doc.Lists.Add(ListTemplate.OutlineHeadingsLegal);
AddOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline 2");
list = doc.Lists.Add(ListTemplate.OutlineHeadingsNumbers);
AddOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline 3");
list = doc.Lists.Add(ListTemplate.OutlineHeadingsChapter);
AddOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline 4");
builder.Document.Save(MyDir + "Lists.OutlineHeadingTemplates Out.doc");
private static void AddOutlineHeadingParagraphs(DocumentBuilder builder, Aspose.Words.Lists.List list, string title)
    for (int i = 0; i < 9; i++)
        builder.ListFormat.List = list;
        builder.ListFormat.ListLevelNumber = i;
        string styleName = "Heading " + (i + 1).ToString();
        builder.ParagraphFormat.StyleName = styleName;

If you still face problem, please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.