com.aspose.words
Class ListCollection

java.lang.Object
    extended by com.aspose.words.ListCollection
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable

public class ListCollection 
extends java.lang.Object

Stores and manages formatting of bulleted and numbered lists used in a document.

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 #Error Cref: P:Aspose.Words.DocumentBase.Lists property.

To create a new list based on a predefined list template or based on a list style, use the #Error Cref: M:Aspose.Words.Lists.ListCollection.Add(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 #Error Cref: P:Aspose.Words.ListFormat.List property of Aspose.Words.ListFormat.

To remove list formatting from a paragraph, use the #Error Cref: M:Aspose.Words.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.

See Also:
List, ListLevel, Aspose.Words.ListFormat

Property Getters/Setters Summary
intgetCount()
           Gets the count of numbered and bulleted lists in the document.
Aspose.Words.DocumentBasegetDocument()
           Gets the owner document.
Listget(int index)
           Gets a list by index.
 
Method Summary
Listadd(int template)
           Creates a new list based on a predefined template and adds it to the collection of lists in the document.
ListaddCopy(List srcList)
           Creates a new list by copying the specified list and adding it to the collection of lists in the document.
ListgetListByListId(int listId)
           Gets a list by a list identifier.
java.util.Iteratoriterator()
           Gets the enumerator object that will enumerate lists in the document.
 

Property Getters/Setters Detail

getCount

public int getCount()
Gets the count of numbered and bulleted lists in the document.

getDocument

public Aspose.Words.DocumentBase getDocument()
Gets the owner document.

get

public List get(int index)
Gets a list by index.

Method Detail

add

public List add(int template)
Creates a new list based on a predefined template and adds it to the collection of lists in the document.

Aspose.Words list templates correspond to the 21 list templates available in the Bullets and Numbering dialog box in Microsoft Word 2003.

All lists created using this method have 9 list levels.

Parameters:
template - A ListTemplate value. The template of the list.
Returns:
The newly created list.

addCopy

public List addCopy(List srcList)
Creates a new list by copying the specified list and adding it to the collection of lists in the document.

The source list can be from any document. If the source list belongs to a different document, a copy of the list is created and added to the current document.

If the source list is a reference to or a definition of a list style, the newly created list is not related to the original list style.

Parameters:
srcList - The source list to copy from.
Returns:
The newly created list.

getListByListId

public List getListByListId(int listId)
Gets a list by a list identifier.

You don't normally need to use this method. Most of the time you apply list formatting to paragraphs just by settings the #Error Cref: P:Aspose.Words.ListFormat.List property of the Aspose.Words.ListFormat object.

Parameters:
listId - The list identifier.
Returns:
Returns the list object. Returns null if a list with the specified identifier was not found.

iterator

public java.util.Iterator iterator()
Gets the enumerator object that will enumerate lists in the document.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.