Hello support,
Is there a way to ident different levels using number in aspose doc for c#.
Level 1: 1 → Level 2: 1.1, 1.2 → Level 3: 1.1.1, 1.1.2, etc…
Level 1: 2 → Level 2: 2.1, 2.2 → Level 3: 2.1.1, 2.1.2, etc…
Level 1: 3 → Level 2: 3.1, 3.2 → Level 3: 3.1.1, 3.1.2, etc…
See attachment for a sample.
Thanks,
@rusty02 The question al already answered in another you thread:
https://forum.aspose.com/t/issue-with-aspose-doc-list-level-indent/291876/2
Please let us know if you still have difficulties. If so, please provide you code, your output and expected documents.
Hello @alexey.noskov
This is a different question. Can you provide aspose c# code to generate the same numberal bullets as shown in the screen shot?
@rusty02 Please try using the following simple code:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create the list and configure it.
List lst = doc.Lists.Add(ListTemplate.NumberArabicDot);
// Configure levels.
lst.ListLevels[0].NumberFormat = "\x0000";
lst.ListLevels[0].NumberStyle = NumberStyle.Arabic;
lst.ListLevels[0].TextPosition = doc.DefaultTabStop;
lst.ListLevels[0].NumberPosition = 0;
lst.ListLevels[0].TabPosition = doc.DefaultTabStop;
lst.ListLevels[0].Alignment = ListLevelAlignment.Left;
//
lst.ListLevels[1].NumberFormat = "\x0000.\x0001";
lst.ListLevels[1].NumberStyle = NumberStyle.Arabic;
lst.ListLevels[1].TextPosition = doc.DefaultTabStop;
lst.ListLevels[1].NumberPosition = 0;
lst.ListLevels[1].TabPosition = doc.DefaultTabStop;
lst.ListLevels[1].Alignment = ListLevelAlignment.Left;
lst.ListLevels[2].NumberFormat = "\x0000.\x0001.\x0002";
lst.ListLevels[2].NumberStyle = NumberStyle.Arabic;
lst.ListLevels[2].Font.Bold = true;
lst.ListLevels[2].Font.Size = 12;
lst.ListLevels[2].TextPosition = doc.DefaultTabStop;
lst.ListLevels[2].NumberPosition = 0;
lst.ListLevels[2].TabPosition = doc.DefaultTabStop;
lst.ListLevels[2].Alignment = ListLevelAlignment.Left;
// To make is easier to work with ist apply it to the styles.
Style lvl1 = doc.Styles.Add(StyleType.Paragraph, "First Level");
lvl1.ListFormat.List = lst;
lvl1.ListFormat.ListLevelNumber = 0;
lvl1.Font.Bold = true;
lvl1.Font.Size = 16;
lvl1.ParagraphFormat.Shading.BackgroundPatternColor = Color.LightGray;
Style lvl2 = doc.Styles.Add(StyleType.Paragraph, "Second Level");
lvl2.ListFormat.List = lst;
lvl2.ListFormat.ListLevelNumber = 1;
lvl2.Font.Bold = true;
lvl2.Font.Size = 14;
Style lvl3 = doc.Styles.Add(StyleType.Paragraph, "Third Level");
lvl3.ListFormat.List = lst;
lvl3.ListFormat.ListLevelNumber = 2;
lvl3.Font.Bold = false;
lvl3.Font.Size = 12;
// Apply list and add some list items.
builder.ParagraphFormat.Style = lvl1;
builder.Writeln("First level");
builder.ParagraphFormat.Style = lvl2;
builder.Writeln("Second level");
builder.ParagraphFormat.Style = lvl3;
builder.Writeln("Third level 1");
builder.Writeln("Third level 2");
builder.Writeln("Third level 3");
builder.ParagraphFormat.Style = lvl2;
builder.Writeln("Second level");
builder.ParagraphFormat.Style = lvl3;
builder.Writeln("Third level 1");
builder.Writeln("Third level 2");
builder.Writeln("Third level 3");
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Normal;
doc.Save(@"C:\Temp\out.docx");
out.docx (7.9 KB)