Examples: BarColor property (NotesRichTextSection - LotusScript®)

This agent displays the bar color of each section in a rich text item.

Function GetColorString(Byval colorCode As Long) As String
  Select Case colorCode
  Case COLOR_BLACK : GetColorString = "Black"
  Case COLOR_BLUE : GetColorString = "Blue"
  Case COLOR_CYAN : GetColorString = "Cyan"
  Case COLOR_DARK_BLUE : GetColorString = "Dark blue"
  Case COLOR_DARK_CYAN : GetColorString = "Dark cyan"
  Case COLOR_DARK_GREEN : GetColorString = "Green"
  Case COLOR_DARK_MAGENTA : GetColorString = "Magenta"
  Case COLOR_DARK_RED : GetColorString = "Red"
  Case COLOR_DARK_YELLOW : GetColorString = "Yellow"
  Case COLOR_GRAY : GetColorString = "Gray"
  Case COLOR_GREEN : GetColorString = "Green"
  Case COLOR_LIGHT_GRAY : GetColorString = "Light gray"
  Case COLOR_MAGENTA : GetColorString = "Magenta"
  Case COLOR_RED : GetColorString = "Red"
  Case COLOR_WHITE : GetColorString = "White"
  Case COLOR_YELLOW : GetColorString = "Yellow"
  Case Else : GetColorString = Cstr(colorCode)
  End Select
End Function

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 = " & _
    GetColorString(rts.Barcolor.NotesColor) _
    ,, rts.Title
  Loop While rtnav.FindNextElement
End Sub