Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Feb 02, 2021 2:32 am

Dear Spire support team,

Could you please help me create Multi-level List which combine number, letter and bullet like attachment file? I also need to set heading to them too.

Thank you very much!

supermun
 
Posts: 24
Joined: Fri May 15, 2020 6:51 am

Tue Feb 02, 2021 8:43 am

Hello,

Thanks for your inquiry.
Please refer to the following code to create Multi-level List. If there are any questions, just feel free to contact us.
Code: Select all
            Document doc = new Document();
            Section section = doc.AddSection();
            ListStyle listStyle = new ListStyle(doc, ListType.Numbered);
            listStyle.Name = "list1";
            listStyle.Levels[0].PatternType = ListPatternType.UpRoman;
            listStyle.Levels[0].StartAt = 1;
            listStyle.Levels[1].PatternType = ListPatternType.UpLetter;
            listStyle.Levels[1].StartAt = 1;
            listStyle.Levels[2].PatternType = ListPatternType.Arabic;
            listStyle.Levels[2].StartAt = 1;
            doc.ListStyles.Add(listStyle);

            Paragraph paragraph = section.AddParagraph();
            paragraph.AppendText("Paragraph1");
            paragraph.Format.OutlineLevel = OutlineLevel.Level1;
            paragraph.ListFormat.ApplyStyle(listStyle.Name);
            paragraph.ListFormat.ListLevelNumber = 0;

            paragraph = section.AddParagraph();
            paragraph.AppendText("Paragraph2");
            paragraph.Format.OutlineLevel = OutlineLevel.Level2;
            paragraph.ListFormat.ApplyStyle(listStyle.Name);
            paragraph.ListFormat.ListLevelNumber = 1;

            paragraph = section.AddParagraph();
            paragraph.AppendText("Paragraph3");
            paragraph.Format.OutlineLevel = OutlineLevel.Level3;
            paragraph.ListFormat.ApplyStyle(listStyle.Name);
            paragraph.ListFormat.ListLevelNumber = 2;

            doc.SaveToFile("result.docx");


Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Thu Feb 04, 2021 3:40 am

Thank you Brian!

supermun
 
Posts: 24
Joined: Fri May 15, 2020 6:51 am

Thu Feb 04, 2021 11:02 am

You are welcome.
If you encounter any issues related to our products in the future, please feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.Doc