public void SpecifyListLevel()
{
//ExStart
//ExFor:ListCollection
//ExFor:List
//ExFor:ListFormat
//ExFor:ListFormat.ListLevelNumber
//ExFor:ListFormat.List
//ExFor:ListTemplate
//ExFor:DocumentBase.Lists
//ExFor:ListCollection.Add(ListTemplate)
//ExSummary:Shows how to specify list level number when building a list using DocumentBuilder.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create a numbered list based on one of the Microsoft Word list templates and
// apply it to the current paragraph in the document builder.
builder.ListFormat.List = doc.Lists.Add(ListTemplate.NumberArabicDot);
// There are 9 levels in this list, lets try them all.
for (int i = 0; i < 9; i++)
{
builder.ListFormat.ListLevelNumber = i;
builder.Writeln("Level " + i);
}
// Create a bulleted list based on one of the Microsoft Word list templates
// and apply it to the current paragraph in the document builder.
builder.ListFormat.List = doc.Lists.Add(ListTemplate.BulletDiamonds);
// There are 9 levels in this list, lets try them all.
for (int i = 0; i < 9; i++)
{
builder.ListFormat.ListLevelNumber = i;
builder.Writeln("Level " + i);
}
// This is a way to stop list formatting.
builder.ListFormat.List = null;
builder.Document.Save(MyDir + @"\Artifacts\Lists.SpecifyListLevel.doc");
//ExEnd
}