The WordProcessor class defines several methods that return references to Enumerator objects. The Enumerator class is based on the Java Enumeration interface. [[PS: So is Enumerate a class or an interface?]] It lets you iterate through a set of names associated with a particular object type. For example, the document you are working on may have several paragraph styles. You can use the enumerateWPParagraphStyles() method to iterate through the names of styles defined for the document. All objects contained in a WordProcessor document have either user-assigned or system-generated names.
An Enumerator is not instantiated directly, but is created by the object that is to have its values enumerated, as just described for WPParagraphStyle. To use an Enumerator object, place its two methods in a loop to walk through the list of names. Use hasMoreNames() as the loop condition. This method returns true if there are more names in the list. Use nextName() to access the next name in the list. Using the name, you can call the appropriate accessor method to obtain a reference to the object. For example, with the name of a paragraph style, you can call findParagraphStyle() to obtain a reference to that WPParagraphStyle object.
Following is a list of methods that let you access the names of various objects contained in a document:
/* Gives you access to the names of the WPParagraphStyle objects in the document. */
Enumerator enumerateParagraphStyles()
/* Gives you access to the names of the WPTable objects in the document. */
Enumerator enumerateTables()
/* Gives you access to the names of the WPImage objects in the document. */
Enumerator enumerateImages()
/* Gives you access to the names of the WPClickHere objects in the document. */
Enumerator enumerateClickHeres()
/* Gives you access to the names of the WPPageLayout objects in the document. */
Enumerator enumeratePageLayouts()
/* Gives you access to the names of the WPDate objects in the document. */
Enumerator enumerateDates()
/* Gives you access to the names of the WPHorizontalLine objects in the document. */
Enumerator enumerateHorizontalLines()
/* Gives you access to the names of the WPMarker objects in the document. */
Enumerator enumerateMarkers()
/* Gives you access to the names of links in the document. */
Enumerator enumerateLinks()
/* Gives you access to the names of bookmarks in the document. */
Enumerator enumerateBookmarks()
/* Gives you access to the names of the document variables in the document. */
Enumerator enumerateDocumentVariables()
[[PS: Not sure how to categorize the "delete" methods that make an object reference go away. They aren't really destructors.]]
See also
WordProcessor accessor and destructor methods
WordProcessor API Index
WordProcessor home page