ListLevelStartAt Property

Returns or sets the starting number for this list level.

Namespace:  Aspose.Words.Lists
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.10.0

ExpandedSyntax

public int StartAt { get; set; }

Property Value

Type: Int32

ExpandedRemarks

Default value is 1.

ExpandedExamples

Shows how to restart numbering in a list by copying a list.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Create a list based on a template
List list1 = doc.Lists.Add(ListTemplate.NumberArabicParenthesis);
// Modify the formatting of the list
list1.ListLevels[0].Font.Color = Color.Red;
list1.ListLevels[0].Alignment = ListLevelAlignment.Right;

builder.Writeln("List 1 starts below:");
// Use the first list in the document for a while
builder.ListFormat.List = list1;
builder.Writeln("Item 1");
builder.Writeln("Item 2");
builder.ListFormat.RemoveNumbers();

// Now I want to reuse the first list, but need to restart numbering
// This should be done by creating a copy of the original list formatting
List list2 = doc.Lists.AddCopy(list1);

// We can modify the new list in any way. Including setting new start number
list2.ListLevels[0].StartAt = 10;

// Use the second list in the document
builder.Writeln("List 2 starts below:");
builder.ListFormat.List = list2;
builder.Writeln("Item 1");
builder.Writeln("Item 2");
builder.ListFormat.RemoveNumbers();

doc.Save(ArtifactsDir + "Lists.RestartNumberingUsingListCopy.docx");
Shows how to apply custom list formatting to paragraphs when using DocumentBuilder.
Document doc = new Document();

// Create a list based on one of the Microsoft Word list templates
List list = doc.Lists.Add(ListTemplate.NumberDefault);

// Completely customize one list level
ListLevel listLevel = list.ListLevels[0];
listLevel.Font.Color = Color.Red;
listLevel.Font.Size = 24;
listLevel.NumberStyle = NumberStyle.OrdinalText;
listLevel.StartAt = 21;
listLevel.NumberFormat = "\x0000";

listLevel.NumberPosition = -36;
listLevel.TextPosition = 144;
listLevel.TabPosition = 144;

// Customize another list level
listLevel = list.ListLevels[1];
listLevel.Alignment = ListLevelAlignment.Right;
listLevel.NumberStyle = NumberStyle.Bullet;
listLevel.Font.Name = "Wingdings";
listLevel.Font.Color = Color.Blue;
listLevel.Font.Size = 24;
listLevel.NumberFormat = "\xf0af"; // A bullet that looks like a star
listLevel.TrailingCharacter = ListTrailingCharacter.Space;
listLevel.NumberPosition = 144;

// Now add some text that uses the list that we created
// It does not matter when to customize the list - before or after adding the paragraphs
DocumentBuilder builder = new DocumentBuilder(doc);

builder.ListFormat.List = list;
builder.Writeln("The quick brown fox...");
builder.Writeln("The quick brown fox...");

builder.ListFormat.ListIndent();
builder.Writeln("jumped over the lazy dog.");
builder.Writeln("jumped over the lazy dog.");

builder.ListFormat.ListOutdent();
builder.Writeln("The quick brown fox...");

builder.ListFormat.RemoveNumbers();

builder.Document.Save(ArtifactsDir + "Lists.CreateCustomList.docx");

ExpandedSee Also