Examples: RowLabels property

  1. This agent gets the first or only table in the Body field of the current document and displays its row labels.

    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_TABLE) Then
        Messagebox "Body item does not contain a table,",, _
        "Error"
        Exit Sub
      End If
      Dim rtt As NotesRichTextTable
      Set rtt = rtnav.GetElement
      labelString = ""
      Forall label In rtt.RowLabels
        If label <> "" Then labelString = labelString & _
        Chr(13) & "  " & label
      End Forall
      If labelString = "" Then labelString = "No labels"
      Messagebox "Row labels = " & labelString,, _
      "NotesRichTextTable"
    End Sub
  2. This agent gets the first or only table in the Body field of the current document and writes row labels to it.

    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_TABLE) Then
        Messagebox "Body item does not contain a table,",, _
        "Error"
        Exit Sub
      End If
      Dim rtt As NotesRichTextTable
      Set rtt = rtnav.GetElement
      Dim labels() As String
      Redim labels(1 To rtt.RowCount)
      For i = 1 To rtt.RowCount
        labels(i) = "Tab " & i
      Next
      rtt.RowLabels = labels
      Call doc.Save(True, True)
    End Sub