public class ListCollection
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Iterable
A list in a Microsoft Word document is a set of list formatting properties. The formatting of the lists is stored in the ListCollection collection separately from the paragraphs of text.
You do not create objects of this class. There is always only one ListCollection object per document and it is accessible via the DocumentBase.getLists() property.
To create a new list based on a predefined list template or based on a list style, use the add(com.aspose.words.Style) method.
To create a new list with formatting identical to an existing list, use the addCopy(com.aspose.words.List) method.
To make a paragraph bulleted or numbered, you need to apply list formatting to a paragraph by assigning a List object to the ListFormat.getList() / ListFormat.setList(com.aspose.words.List) property of ListFormat.
To remove list formatting from a paragraph, use the ListFormat.removeNumbers() method.
If you know a bit about WordprocessingML, then you might know it defines separate concepts for "list" and "list definition". This exactly corresponds to how list formatting is stored in a Microsoft Word document at the low level. List definition is like a "schema" and list is like an instance of a list definition.
To simplify programming model, Aspose.Words hides the distinction between list and list definition in much the same way like Microsoft Word hides this in its user interface. This allows you to concentrate more on how you want your document to look like, rather than building low-level objects to satisfy requirements of the Microsoft Word file format.
It is not possible to delete lists once they are created in the current version of Aspose.Words. This is similar to Microsoft Word where user does not have explicit control over list definitions.
List,
ListLevel,
ListFormat| Modifier and Type | Method and Description |
|---|---|
List |
add(int listTemplate) |
List |
add(Style listStyle)
Creates a new list that references a list style and adds it to the collection of lists in the document.
|
List |
addCopy(List srcList)
Creates a new list by copying the specified list and adding it to the collection of lists in the document.
|
List |
get(int index)
Gets a list by index.
|
int |
getCount()
Gets the count of numbered and bulleted lists in the document.
|
DocumentBase |
getDocument()
Gets the owner document.
|
List |
getListByListId(int listId)
Gets a list by a list identifier.
|
java.util.Iterator |
iterator()
Gets the enumerator object that will enumerate lists in the document.
|
protected java.lang.Object |
memberwiseClone() |
public java.util.Iterator iterator()
iterator in interface java.lang.Iterablepublic List add(int listTemplate)
public List add(Style listStyle)
listStyle - The list style.public List addCopy(List srcList)
srcList - The source list to copy from.public List getListByListId(int listId)
listId - The list identifier.public int getCount()
public List get(int index)
public DocumentBase getDocument()
protected java.lang.Object memberwiseClone()