LOTUSSCRIPT/COM/OLE CLASSES


Example: Working with sections in LotusScript classes
This agent displays properties for all the sections in the Body item of the current document.

Sub Initialize
 Dim session As New NotesSession
 Dim db As NotesDatabase
 Set db = session.CurrentDatabase
 Dim dc As NotesDocumentCollection
 Set dc = db.UnprocessedDocuments
 Dim doc As NotesDocument
 Set doc = dc.GetFirstDocument
 Dim rti As NotesRichTextItem
 Set rti = doc.GetFirstItem("Body")
 Dim rtnav As NotesRichTextNavigator
 Set rtnav = rti.CreateNavigator
 If Not rtnav.FindFirstElement(RTELEM_TYPE_SECTION) Then
   Messagebox "Body item does not contain a section,",, "Error"
   Exit Sub
 End If
 Dim rts As NotesRichTextSection
 Do
   Set rts = rtnav.GetElement
   Messagebox "Bar color = " & rts.BarColor.NotesColor & Chr(13) & _
   "Is expanded = " & rts.IsExpanded & Chr(13) & _
   "Title style font = " & rts.TitleStyle.NotesFont _
   ,, rts.Title
 Loop While rtnav.FindNextElement(RTELEM_TYPE_SECTION, 1)
End Sub

See Also