DocumentBaseLists Property

Provides access to the list formatting used in the document.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.7.0

Syntax

public ListCollection Lists { get; }

Property Value

Type: ListCollection

Remarks

For more information see the description of the ListCollection class.

Examples

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);

// Insert text at each of the 9 indent levels
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);

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;

doc.Save(ArtifactsDir + "Lists.SpecifyListLevel.docx");

See Also