Multilevel Lists

Hi everyone,

Does Aspose.Words support multilevel lists?

I’m trying to build something like:

  1. One
    1.1. One point one
  2. Two
    2.1. Two point one
  3. Three

Thank you!

Hi

Thanks for your inquiry. Yes, of course, Aspose.Words supports multilevel lists. Please see the following link to learn how to build such list:
https://reference.aspose.com/words/net/aspose.words.lists/listformat/applynumberdefault/
Please let me know in case of any issues, I will be glad to help you.
Best regards.

Hi Alexey,
Thank you for your reply.
I already checked the examples. I also have the AllSamples solution, looking at ExLists.cs. I couldn’t find an example to give me the desired output. The code below outputs something like:

  1. Title
    a. Subtitle

I need “1.1” instead of “a”. What do I need to set? (Word has Multilevel List option, which is different then Numbering. Unless I’m missing something, the examples are using Numbering)

DocumentBuilder.ListFormat.List = Document.Lists.Add(ListTemplate.NumberDefault);
DocumentBuilder.ListFormat.ListLevel.NumberPosition = 0;
DocumentBuilder.ListFormat.ListLevel.TrailingCharacter = ListTrailingCharacter.Space;
DocumentBuilder.Writeln("Title");
DocumentBuilder.ListFormat.RemoveNumbers();

DocumentBuilder.ListFormat.List = Document.Lists.Add(ListTemplate.NumberDefault);
DocumentBuilder.ListFormat.ListIndent();

DocumentBuilder.ListFormat.ListLevel.NumberPosition = 0;

DocumentBuilder.ListFormat.ListLevel.TrailingCharacter = ListTrailingCharacter.Space;

DocumentBuilder.Writeln("SubTitle");

DocumentBuilder.ListFormat.RemoveNumbers();

Thank you!

Hi

Thanks for your inquiry. You can use NumberFormat and NumberStyle to achieve this. Please see the following code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.ListFormat.List = doc.Lists.Add(ListTemplate.NumberDefault);
builder.Writeln("Title1");
builder.ListFormat.ListIndent();
builder.ListFormat.ListLevel.NumberStyle = NumberStyle.Arabic;
builder.ListFormat.ListLevel.NumberFormat = "\x0000.\x0001";
builder.Writeln("SubTitle1");
builder.Writeln("SubTitle2");
builder.ListFormat.ListOutdent();
builder.Writeln("Title2");
builder.ListFormat.RemoveNumbers();
doc.Save(@"Test001\out.doc");

Also see the following link:
https://reference.aspose.com/words/net/aspose.words.lists/listlevel/numberformat/
Hope this helps.
Best regards.