Navigating in rich text items in LotusScript® classes
Use NotesDocument.GetFirstItem or NotesDocument.Items to access an item as a rich text item. Declare the return value as NotesRichTextItem not NotesItem.
For navigation, a rich text item is a collection of elements of various types accessible through NotesRichTextNavigator . You can find (navigate to) all types of elements. You can get some types of elements as objects; others you cannot get but must access through NotesRichTextRange . The element types are:
- RTELEM_TYPE_DOCLINK (5) is a doclink, which you can get as a NotesRichTextDocLink object
- RTELEM_TYPE_FILEATTACHMENT (8) is a file attachment, which you can get as a NotesEmbeddedObject of type EMBED_ATTACHMENT
- RTELEM_TYPE_OLE (9) is an OLE object , which you can get as a NotesEmbeddedObject of type EMBED_OBJECT or EMBED_OBJECTLINK
- RTELEM_TYPE_SECTION (6) is a collapsible section, which you can get as a NotesRichTextSection object
- RTELEM_TYPE_TABLE (1) is a table, which you can get as a NotesRichTextTable object
- RTELEM_TYPE_TABLECELL (7) is table cell, which you must access through NotesRichTextRange
- RTELEM_TYPE_TEXTPARAGRAPH (4) is a paragraph of text, which you must access through NotesRichTextRange
- RTELEM_TYPE_TEXTRUN (3) is a paragraph or less of text of the same style, which you must access through NotesRichTextRange
Use NotesRichTextItem.CreateNavigator or NotesRichTextRange.Navigator to create a NotesRichTextNavigator object.
Navigation is within elements of the same type. You can find or get the first element of a type, the next element of a type, and the nth element of a type. You cannot find or get an element regardless of type.
The navigator maintains a current position. Both find and get operations change the current position in the rich text item.
NotesRichTextNavigator has the following methods:
- FindFirstElement moves the current position to the first element of a specified type in a rich text item.
- FindLastElement moves the current position to the last element of a specified type in a rich text item.
- FindNextElement moves the current position to the next element of a specified type in a rich text item after the current position.
- FindNthElement moves the current position to the element at a specified position within elements of the same type.
- FindFirstString moves the current position to the beginning of the first occurrence of a string in a rich text item.
- FindNexString moves the current position to the beginning of the next occurrence of a string in a rich text item after the current position.
- GetElement returns the element at the current position.
- GetFirstElement returns the first element of a specified type in a rich text item.
- GetLastElement returns the last element of a specified type in a rich text item.
- GetNextElement returns the element of a specified type at a position in a rich text item after the current position.
- GetNthElement returns the element of a specified type at a specified position in a rich text item.
- SetPosition sets the current position to a specified element in a rich text item.
- SetPositionAtEnd sets the current position at the end of a specified element in a rich text item.
- SetCharOffset sets the current position to an offset from the current position.
- Clone creates another NotesRichTextNavigator object with the same position as the current one.