Free Support Forum - aspose.com

If I cancel the list number in section break- was cancelled by the list number in the paragraph

I have this code, 1 define a custom list;2 paragraphs with the custom list; 3 insert a section break; my question is, after I insert a section break, Section break is preceded by list number, if I cancel the list number in section break, was cancelled by the list number in the paragraph, I need list number in the paragrph,how to solve it?

Aspose.Words.Lists.List list1 = doc.Lists.Add(Aspose.Words.Lists.ListTemplate.OutlineLegal);
// Modify the formatting of the list.
list1.ListLevels[0].NumberFormat = "%1 ";
list1.ListLevels[1].NumberFormat = "%1.%2 ";
list1.ListLevels[2].NumberFormat = "%1.%2.%3 ";
list1.ListLevels[3].NumberFormat = "%1.%2.%3.%4 ";

foreach (Aspose.Words.Paragraph p in doca.Sections[0].Body.Paragraphs)
{

p.ListFormat.List = NewList;
p.ListFormat.ListLevelNumber = 0;

}

builder.MoveToSection(0);

builder.InsertBreak(BreakType.SectionBreakNewPage);

//after this code ,the document has list number front sectonbreak;

//I use ListFormat.RemoveNumbers,the list number of paragraph is removed,but I need list number of paragraph

Hi,


Thanks for your inquiry.

Please attach your target Word document here for our reference. I will investigate as to how you are expecting your final document to be generated like. You can use Microsoft Word to create your target Word document. I will then provide you code to achieve the same by using Aspose.Words.

Best Regards,