Examples: NotesRichTextNavigator class
This agent displays the number of elements of each type in the Body item of the current or first selected document.
Dim session As NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim rti As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
Sub Initialize
Set session = New NotesSession
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
If dc.Count = 0 Then
Messagebox "Nothing selected",, "No documents"
Exit Sub
End If
Set rti = doc.GetFirstItem("Body")
Set rtnav = rti.CreateNavigator
Messagebox _
"Number of doc links = " & GetCount(RTELEM_TYPE_DOCLINK) _
& Chr(13) & _
"Number of file attachments = " & GetCount(RTELEM_TYPE_FILEATTACHMENT) _
& Chr(13) & _
"Number of OLE objects = " & GetCount(RTELEM_TYPE_OLE) _
& Chr(13) & _
"Number of sections = " & GetCount(RTELEM_TYPE_SECTION) _
& Chr(13) & _
"Number of tables = " & GetCount(RTELEM_TYPE_TABLE) _
& Chr(13) & _
"Number of table cells = " & GetCount(RTELEM_TYPE_TABLECELL) _
& Chr(13) & _
"Number of text paragraphs = " & GetCount(RTELEM_TYPE_TEXTPARAGRAPH) _
& Chr(13) & _
"Number of text runs = " & GetCount(RTELEM_TYPE_TEXTRUN),, _
"Elements in Body item"
End Sub
Function GetCount(elementType As Integer) As Integer
GetCount = 0
If rtnav.FindFirstElement(elementType) Then
Do
GetCount = GetCount + 1
Loop While rtnav.FindNextElement(elementType)
End If
End Function