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.

Fri Jan 10, 2020 6:49 am

is there a setting that i can use to specify restart list number?
as for the picture:

Code: Select all
            Document document = new Document();
            var section = document.AddSection();

            ListStyle listStyle = new ListStyle(document, ListType.Numbered);
            listStyle.Name = "levelstyle";

            listStyle.Levels[0].PatternType = ListPatternType.Arabic;
            listStyle.Levels[0].NumberPrefix = "第";
            listStyle.Levels[0].NumberSufix = "章";
            listStyle.Levels[0].PatternType = ListPatternType.ChineseCountingThousand;
            listStyle.Levels[0].FollowCharacter = FollowCharacterType.Nothing;
            listStyle.Levels[0].IsLegalStyleNumbering = false;
            listStyle.Levels[0].NoRestartByHigher = false;
            listStyle.Levels[0].UsePrevLevelPattern = false;

            listStyle.Levels[1].UsePrevLevelPattern = true;
            listStyle.Levels[1].PatternType = ListPatternType.ChineseCountingThousand;
            listStyle.Levels[1].NumberPrefix = "(";
            listStyle.Levels[1].NumberSufix = ")";

            listStyle.Levels[2].PatternType = ListPatternType.Arabic;
            listStyle.Levels[2].NumberPrefix = "";
            listStyle.Levels[2].NumberSufix = "";
            listStyle.Levels[2].IsLegalStyleNumbering = true;

            listStyle.Levels[3].UsePrevLevelPattern = false;
            listStyle.Levels[3].PatternType = ListPatternType.Arabic;
            listStyle.Levels[3].NumberPrefix = "表\x0000-";
            listStyle.Levels[3].NumberSufix = "";
            listStyle.Levels[3].IsLegalStyleNumbering = true;
            listStyle.Levels[3].ParagraphFormat.LeftIndent = 0;
            listStyle.Levels[3].ParagraphFormat.LineSpacing = 12 * 1.5f;
            listStyle.Levels[3].ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Center;
            listStyle.Levels[3].ParagraphFormat.KeepFollow = false;
            listStyle.Levels[3].CharacterFormat.Bold = false;
            listStyle.Levels[3].CharacterFormat.FontName = "黑体";
            listStyle.Levels[3].CharacterFormat.FontSize = 9;

            listStyle.Levels[4].UsePrevLevelPattern = false;
            listStyle.Levels[4].PatternType = ListPatternType.Arabic;
            listStyle.Levels[4].NumberPrefix = "图\x0000-";
            listStyle.Levels[4].NumberSufix = "";
            listStyle.Levels[4].IsLegalStyleNumbering = true;
            listStyle.Levels[4].ParagraphFormat.LeftIndent = 0;
            listStyle.Levels[4].ParagraphFormat.LineSpacing = 12 * 1.5f;
            listStyle.Levels[4].ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Center;
            listStyle.Levels[4].ParagraphFormat.KeepFollow = false;
            listStyle.Levels[4].CharacterFormat.Bold = false;
            listStyle.Levels[4].CharacterFormat.FontName = "黑体";
            listStyle.Levels[4].CharacterFormat.FontSize = 9;

            document.ListStyles.Add(listStyle);

            var paragraph = section.AddParagraph();
            paragraph.AppendText("chapter1");
            paragraph.ApplyStyle(BuiltinStyle.Heading1);
            paragraph.ListFormat.ListLevelNumber = 0;
            paragraph.ListFormat.ApplyStyle("levelstyle");

            paragraph = section.AddParagraph();
            paragraph.AppendText("table1");
            paragraph.ApplyStyle(BuiltinStyle.Caption);
            paragraph.ListFormat.ListLevelNumber = 3;
            paragraph.ListFormat.ApplyStyle("levelstyle");

            section = document.AddSection();
            paragraph = section.AddParagraph();
            paragraph.AppendText("chart1");
            paragraph.ApplyStyle(BuiltinStyle.Caption);
            paragraph.ListFormat.ListLevelNumber = 4;
            paragraph.ListFormat.ApplyStyle("levelstyle");

            paragraph = section.AddParagraph();
            paragraph.AppendText("chapter2");
            paragraph.ApplyStyle(BuiltinStyle.Heading1);
            paragraph.ListFormat.ListLevelNumber = 0;
            paragraph.ListFormat.ApplyStyle("levelstyle");

            paragraph = section.AddParagraph();
            paragraph.AppendText("SubItem1");
            paragraph.ApplyStyle(BuiltinStyle.Heading2);
            paragraph.ListFormat.ListLevelNumber = 1;
            paragraph.ListFormat.ApplyStyle("levelstyle");
            paragraph.ListFormat.ContinueListNumbering();

            paragraph = section.AddParagraph();
            paragraph.AppendText("SubSubItem1");
            paragraph.ApplyStyle(BuiltinStyle.Heading3);
            paragraph.ListFormat.ListLevelNumber = 2;
            paragraph.ListFormat.ApplyStyle("levelstyle");
            paragraph.ListFormat.ContinueListNumbering();

            paragraph = section.AddParagraph();
            paragraph.AppendText("table2-1");
            paragraph.ApplyStyle(BuiltinStyle.Caption);
            paragraph.ListFormat.ListLevelNumber = 3;
            paragraph.ListFormat.ApplyStyle("levelstyle");
            paragraph.ListFormat.ContinueListNumbering();


            //section = document.AddSection();
            paragraph = section.AddParagraph();
            paragraph.AppendText("IndexSection1");
            paragraph.ApplyStyle(BuiltinStyle.Heading3);
            paragraph.ListFormat.ListLevelNumber = 2;
            paragraph.ListFormat.ApplyStyle("levelstyle");
            paragraph.ListFormat.ContinueListNumbering();

            paragraph = section.AddParagraph();
            paragraph.AppendText("chart2-1");
            paragraph.ApplyStyle(BuiltinStyle.Caption);
            paragraph.ListFormat.ListLevelNumber = 4;
            paragraph.ListFormat.ApplyStyle("levelstyle");
            paragraph.ListFormat.ContinueListNumbering();

            paragraph = section.AddParagraph();
            paragraph.AppendText("chart2-2");
            paragraph.ApplyStyle(BuiltinStyle.Caption);
            paragraph.ListFormat.ListLevelNumber = 4;
            paragraph.ListFormat.ApplyStyle("levelstyle");
            paragraph.ListFormat.ContinueListNumbering();

            //section = document.AddSection();
            paragraph = section.AddParagraph();
            paragraph.AppendText("IndexSection2");
            paragraph.ApplyStyle(BuiltinStyle.Heading3);
            paragraph.ListFormat.ListLevelNumber = 2;
            paragraph.ListFormat.ApplyStyle("levelstyle");

            paragraph = section.AddParagraph();
            paragraph.AppendText("table2-2");
            paragraph.ApplyStyle(BuiltinStyle.Caption);
            paragraph.ListFormat.ListLevelNumber = 3;
            paragraph.ListFormat.ApplyStyle("levelstyle");
            paragraph.ListFormat.ContinueListNumbering();

standheo
 
Posts: 24
Joined: Mon Oct 08, 2018 11:13 am

Fri Jan 10, 2020 10:26 am

Hi,

Thanks for your inquiry.
I have posted your requirement to our Dev team. We will let you know once there is any update.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc