ListCollectionItem Property

Gets a list by index.

Namespace:  Aspose.Words.Lists
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public List this[
	int index
] { get; }

Parameters

index
Type: SystemInt32

Property Value

Type: List
Examples
Applies list formatting of an existing list to a collection of paragraphs.
Body body = doc.FirstSection.Body;
List list = doc.Lists[0];
foreach (Paragraph paragraph in body.Paragraphs.OfType<Paragraph>())
{
    paragraph.ListFormat.List = list;
    paragraph.ListFormat.ListLevelNumber = 2;
}
Examples
Illustrates the owner document properties of lists.
Document doc = new Document();

ListCollection lists = doc.Lists;
// All of these should be equal
Console.WriteLine("ListCollection document is doc: " + (doc == lists.Document));
Console.WriteLine("Starting list count: " + lists.Count);

List list = lists.Add(ListTemplate.BulletDefault);
Console.WriteLine("List document is doc: " + (list.Document == doc));
Console.WriteLine("List count after adding list: " + lists.Count);
Console.WriteLine("Is the first document list: " + (lists[0].Equals(list)));
Console.WriteLine("ListId: " + list.ListId);
Console.WriteLine("List is the same by ListId: " + (lists.GetListByListId(1).Equals(list)));
See Also