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 Lists property.
To create a new list based on a predefined list template or based on a list style, use the Add() method.
To create a new list with formatting identical to an existing list, use the AddCopy() method.
To make a paragraph bulleted or numbered, you need to apply list formatting to a paragraph by assigning a List object to the List property of ListFormat.
To remove list formatting from a paragraph, use the 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.
Shows how to work with list levels.
Shows how to restart numbering in a list by copying a list.
Shows how to create a document with a sample of all the lists from another document.
#include <Aspose.Words.Cpp/Lists/ListCollection.h>
Inheritance diagram for Aspose::Words::Lists::ListCollection:Public Types | |
| using | const_iterator = typename const_iterator |
| using | iterator = typename iterator |
| using | iterator_holder_type = List< SharedPtr< List > > |
Public Member Functions | |
| SharedPtr< List > | Add (ListTemplate listTemplate) |
| Creates a new list based on a predefined template and adds it to the collection of lists in the document. More... | |
| SharedPtr< List > | Add (SharedPtr< Style > listStyle) |
| Creates a new list that references a list style and adds it to the collection of lists in the document. More... | |
| SharedPtr< List > | AddCopy (SharedPtr< List > srcList) |
| Creates a new list by copying the specified list and adding it to the collection of lists in the document. More... | |
| const_iterator | begin () const noexcept |
| iterator | begin () noexcept |
| const_iterator | cbegin () const noexcept |
| const_iterator | cend () const noexcept |
| const_iterator | end () const noexcept |
| iterator | end () noexcept |
| int32_t | get_Count () |
| Gets the count of numbered and bulleted lists in the document. More... | |
| SharedPtr< DocumentBase > | get_Document () const |
| Gets the owner document. More... | |
| SharedPtr< IEnumerator< SharedPtr< List > > > | GetEnumerator () override |
| Gets the enumerator object that will enumerate lists in the document. More... | |
| SharedPtr< List > | GetListByListId (int32_t listId) |
| Gets a list by a list identifier. More... | |
| virtual const TypeInfo & | GetType () const override |
| SharedPtr< List > | idx_get (int32_t index) |
| Gets a list by index. More... | |
| virtual bool | Is (const TypeInfo &target) const override |
Static Public Member Functions | |
| static const TypeInfo & | Type () |
| using Aspose::Words::Lists::ListCollection::const_iterator = typename iterator_holder_type::const_iterator |
| using Aspose::Words::Lists::ListCollection::iterator_holder_type = System::Collections::Generic::List<System::SharedPtr<Aspose::Words::Lists::List> > |
| System::SharedPtr<Aspose::Words::Lists::List> Aspose::Words::Lists::ListCollection::Add | ( | Aspose::Words::Lists::ListTemplate | listTemplate | ) |
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.
| listTemplate | The template of the list. |
Shows how to work with list levels.
Shows how to restart numbering in a list by copying a list.
Shows how to create a list by applying a new list format to a collection of paragraphs.
| System::SharedPtr<Aspose::Words::Lists::List> Aspose::Words::Lists::ListCollection::Add | ( | System::SharedPtr< Aspose::Words::Style > | listStyle | ) |
Creates a new list that references a list style and adds it to the collection of lists in the document.
The newly created list references the list style. If you change the properties of the list style, it is reflected in the properties of the list. Vice versa, if you change the properties of the list, it is reflected in the properties of the list style.
| listStyle | The list style. |
Shows how to create a list style and use it in a document.
| System::SharedPtr<Aspose::Words::Lists::List> Aspose::Words::Lists::ListCollection::AddCopy | ( | System::SharedPtr< Aspose::Words::Lists::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.
| srcList | The source list to copy from. |
Shows how to restart numbering in a list by copying a list.
Shows how to create a document with a sample of all the lists from another document.
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
| int32_t Aspose::Words::Lists::ListCollection::get_Count | ( | ) |
Gets the count of numbered and bulleted lists in the document.
Shows how to verify owner document properties of lists.
| System::SharedPtr<Aspose::Words::DocumentBase> Aspose::Words::Lists::ListCollection::get_Document | ( | ) | const |
Gets the owner document.
Shows how to verify owner document properties of lists.
|
override |
Gets the enumerator object that will enumerate lists in the document.
Shows how to create a document with a sample of all the lists from another document.
| System::SharedPtr<Aspose::Words::Lists::List> Aspose::Words::Lists::ListCollection::GetListByListId | ( | int32_t | 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 List property of the ListFormat object.
| listId | The list identifier. |
Shows how to verify owner document properties of lists.
|
overridevirtual |
Reimplemented from System::Object.
| System::SharedPtr<Aspose::Words::Lists::List> Aspose::Words::Lists::ListCollection::idx_get | ( | int32_t | index | ) |
Gets a list by index.
Shows how to apply list formatting of an existing list to a collection of paragraphs.
Shows how to verify owner document properties of lists.
|
overridevirtual |
Reimplemented from System::Object.
|
static |