WordProcessor Object Model

The WordProcessor class exposes many of its programmable functions using a hierarchical object model. The WordProcessor class itself provides API properties and methods that operate on the document as a whole. The objects contained in a WordProcessor instance represent styles and formats you apply to elements the document contains, for example, pages, paragraphs, headers, footers, and tables. It also contains classes that define text elements, such as paragraph leaders (bullets and numbers), horizontal lines, tab stops, Click Here blocks, and bookmarks. The classes that define these objects provide API properties and methods to manipulate the objects and change their appearance. For example, the WPParagraphStyle method setAlignment() sets the justification for a paragraph. The WPTable method insertRow() inserts a row in the table.

The diagram below shows the WordProcessor object hierarchy. [[PS: How would you describe the hierarchy? I'm not sure what terms are correct. WordProcessor is the parent class. It "contains?" the WPBaseObject and WPEnumerator classes. The WPBaseObject class has several "sub-classes?" that extend the functions of WPBaseObject. Is this correct terminology?]]

[[PS: It would be nice to have this diagram contain links to the appropriate sections of the HTML document. How can I do this?]]

WordProcessor object model
[[PS: What about WPLink and WPBookmark? Where do they fit in the hierarchy? ]]

WordProcessor

WordProcessor is the parent class. It provides the methods and properties that operate on the document as a whole. The WordProcessor class lets you perform insertion, navigation, and text manipulation operations. It also lets you load and print documents, and set font and paragraph styles.

To create an instance of the WordProcessor class, embed an Applet tag in your HTML file.

WPBaseObject

WPBaseObject contains several subclasses that represent the styles, formats, and elements of the document. WPBaseObject provides methods by which you can get and set the names of objects associated with the document, such as paragraph styles, date formats, and tables.

To obtain a reference to a WPBaseObject [[PS: How do I obtain a reference to it?]]

WPParagraphStyle

WPParagraphStyle extends WPBaseObject. It provides the properties that specify the font and text attributes, line and paragraph spacing, indentation, and alignment you can apply to a paragraph.

To obtain a reference to a WPParagraphStyle object, call findParagraphStyle().

WPParagraphLeader

WPParagraphLeader extends WPBaseObject. It provides the properties that specify the style and spacing of the leader characters, such as bullets and numbers, you can apply to a paragraph.

To obtain a reference to a WPParagraphLeader object, call findParagraphLeader().

WPPageLayout

WPPageLayout extends WPBaseObject. It provides the methods and properties that specify the overall appearance of the page. For example, you can set the layout of the header and footer, the page margins, and the tab stops.

To obtain a reference to a WPPageLayout object, call findPageLayout().

WPHFLayout

WPHFLayout extends WPBaseObject. It provides the properties that specify the margins for the page header and footer.

To obtain a reference to a WPHFLayout object, call the WPPageLayout methods getHeaderLayout() and getFooterLayout().

WPTabStop

WPTabStop extends WPBaseObject. It provides the properties that specify the tab type (for example, left- or right-aligned) and offset.

To obtain a reference to a WPTabStop object, call the WPPageLayout method findTabStop(). To insert a new tab stop, call the WPPageLayout method insertTabStop().

WPContainer

WPContainer extends WPBaseObject. It provides the properties that specify the border and background of the document.

To obtain a reference to a WPContainer object, call find???(). [[PS: How do I get a reference to the container object? There doesn't seem to be a "find" method for this class. ]]

WPTable

WPTable extends the WPContainer class. It provides the properties that specify the appearance of a table, including the width, border, and cell alignment.

To obtain a reference to a WPTable object, call findTable(). To insert a new table in a document, call insertTable().

WPTableCell

WPTableCell extends the WPContainer class. It provides the properties that specify the alignment and text for an individual cell in a table.

To obtain a reference to a WPTableCell object, call the WPTable method findTableCell().

WPImage

WPImage extends WPBaseObject. It provides the properties that specify the source, size, spacing, and alignment of an image to embed in the document.

To obtain a reference to a WPImage object, call findImage(). To insert a new image in a document, call insertImage().

WPClickHere

WPClickHere extends WPBaseObject. It provides the properties that specify the prompt and text for a Click Here block. Click Here blocks are placeholders that help you create or use a document. If you insert Click Here blocks in a document, readers of your document can TAB to each block to be prompted to enter information. [[How robust is this feature in WP? In WordPro you can do a lot with Click Here blocks, it seems.]]

To obtain a reference to a WPClickHere object, call findClickHere(). To insert a new Click Here block in a document, call insertClickHere().

WPDate

WPDate extends WPBaseObject. It provides the properties that specify the date format.

To obtain a reference to a WPDate object, call findDate(). To insert a date in a document, call insertDate().

WPPageNumber

WPPageNumber extends WPBaseObject. It provides the property that specifies the page number format.

To insert a page number in a document, call insertPageNumber(). [[PS: There is no find method to obtain a reference to an existing page number. Does that mean that page numbers in existing documents are not accessible? They must be inserted anew?]]

WPHorizontalLine

WPHorizontalLine extends WPBaseObject. It provides the properties that specify the size, width, color, and alignment of a horizontal rule.

To obtain a reference to a WPHorizontalLine object, call findHorizontalLine(). To insert a new horizontal line in a document, call insertHorizontalLine().

WPMarker

WPMarker extends WPBaseObject. It provides the properties that specify the text for a marker. [[PS: What type of marker?]].

To obtain a reference to a WPMarker object, call findMarker(). To insert a new marker in a document, call insertMarker().

WPBookmark

WPBookmark has no API properties and methods. However, you can insert bookmarks and obtain references to them. Call insertBookmark() to insert a bookmark, and findBookmark() to obtain a reference to one.

WPLink

WPLink has no API properties and methods. However, you can insert links and obtain references to them. Call insertLink() to insert a link, and findLink() to obtain a reference to one.

WPEnumerator

WPEnumerator provides the methods and properties that let you navigate enumerated values. It lets you check for more values and get the next one.

To obtain a reference to a WPEnumerator object, call the Enumerator method appropriate to the type of object you want to work with. [[PS: The Enumerator methods return values of type Enumerator. Should this be type WPEnumerator?]]

See also
WordProcessor home page
WordProcessor API Index