Examples: Getting text renditions of rich text items in LotusScript® classes

  1. This agent uses NotesDocument.GetItemValue to get a text rendition of the Body item in the first (or only) selected document.
    Dim session As NotesSession
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument
    
    Sub Initialize
      Set session = New NotesSession
      Set db = session.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      If dc.Count = 0 Then Exit Sub
      Set doc = dc.GetFirstDocument
      bodyArray = doc.GetItemValue("Body")
      Messagebox bodyArray(0),, "Text of Body"
    End Sub
  2. This agent uses NotesItem.Text to get a text rendition of the Body item in the first (or only) selected document.
    Dim session As NotesSession
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim item As NotesItem
    
    Sub Initialize
      Set session = New NotesSession
      Set db = session.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      If dc.Count = 0 Then Exit Sub
      Set doc = dc.GetFirstDocument
      Set item = doc.GetFirstItem("Body")
      If item Is Nothing Then Exit Sub
      Messagebox item.Text,, "Text of Body"
    End Sub
  3. This agent uses NotesItem.Values to get a text rendition of the Body item in the first (or only) selected document.
    Dim session As NotesSession
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim item As NotesItem
    
    Sub Initialize
      Set session = New NotesSession
      Set db = session.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      If dc.Count = 0 Then Exit Sub
      Set doc = dc.GetFirstDocument
      Set item = doc.GetFirstItem("Body")
      If item Is Nothing Then Exit Sub
      Messagebox item.Values,, "Text of Body"
    End Sub
  4. This agent uses NotesItem.Abstract to get an abbreviated text rendition of the Body item in the first (or only) selected document.
    Dim session As NotesSession
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim item As NotesItem
    
    Sub Initialize
      Set session = New NotesSession
      Set db = session.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      If dc.Count = 0 Then Exit Sub
      Set doc = dc.GetFirstDocument
      Set item = doc.GetFirstItem("Body")
      If item Is Nothing Then Exit Sub
      Messagebox item.Abstract(32, True, False),, "Text of Body"
    End Sub
  5. This agent uses NotesRichTextItem.GetFormattedText to get a modified text rendition of the Body item in the first (or only) selected document.
    Dim session As NotesSession
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim rti As NotesRichTextItem
    
    Sub Initialize
      Set session = New NotesSession
      Set db = session.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      If dc.Count = 0 Then Exit Sub
      Set doc = dc.GetFirstDocument
      Set rti = doc.GetFirstItem("Body")
      If rti Is Nothing Then Exit Sub
      Messagebox rti.GetFormattedText(True, 20),, "Text of Body"
    End Sub
  6. This agent uses NotesRichTextItem.GetUnformattedText to get a text rendition of the Body item in the first (or only) selected document.
    Dim session As NotesSession
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim rti As NotesRichTextItem
    
    Sub Initialize
      Set session = New NotesSession
      Set db = session.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      If dc.Count = 0 Then Exit Sub
      Set doc = dc.GetFirstDocument
      Set rti = doc.GetFirstItem("Body")
      If rti Is Nothing Then Exit Sub
      Messagebox rti.GetUnformattedText(),, "Text of Body"
    End Sub