Examples: SetCharOffset method

This agent gets the first text paragraph starting at the ninth character.

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim dc As NotesDocumentCollection
  Dim doc As NotesDocument
  Dim body As NotesRichTextItem
  Dim rtnavBody As NotesRichTextNavigator
  Dim rtrangePara As NotesRichTextRange
  Set db = session.CurrentDatabase
  Set dc = db.UnprocessedDocuments
  Set doc = dc.GetFirstDocument
  Set body = doc.GetFirstItem("Body")
  REM Get first paragraph in Body item
  Set rtnavBody = body.CreateNavigator
  If Not rtnavBody.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH) Then
    Messagebox "Body item does not contain text,",, _
    "Error"
    Exit Sub
  End If
  Set rtrangePara = body.CreateRange
  REM Get first para starting with position 9
  Call rtnavBody.SetCharOffset(8)
  Set rtrangePara = body.CreateRange
  Call rtrangePara.SetBegin(rtnavBody)
  Messagebox rtrangePara.TextParagraph,, "First para starting at 9"
End Sub