Examples: Clone method (NotesRichTextRange - LotusScript®)
This agent gets the first paragraph in the Body item of the current document in a created range, then gets the second paragraph in a cloned range.
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 rtrangePara1 As NotesRichTextRange
Dim rtrangePara2 As NotesRichTextRange
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
Set body = doc.GetFirstItem("Body")
REM Create navigator
Set rtnavBody = body.CreateNavigator
REM Get first paragraph
If Not rtnavBody.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH) Then
Messagebox "Body item does not have text",, _
"Error "
Exit Sub
End If
Set rtrangePara1 = body.CreateRange
Call rtrangePara1.SetBegin(rtnavBody)
REM Clone range
Set rtrangePara2 = rtrangePara1.Clone
REM Get second paragraph
If Not rtnavBody.FindNextElement(RTELEM_TYPE_TEXTPARAGRAPH) Then
Messagebox "Body item does not have second paragraph",, _
"Error"
Exit Sub
End If
Call rtrangePara2.SetBegin(rtnavBody)
REM Display range text
Messagebox rtrangePara1.TextParagraph,, "Paragraph 1"
Messagebox rtrangePara2.TextParagraph,, "Paragraph 2"
End Sub