LOTUSSCRIPT /COM/OLE のクラス


例:Clone メソッド
次のエージェントは、作成された範囲における現在の文書の Body アイテムの最初の段落を取得した後、複製された範囲の 2 番目の段落を取得します。

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

関連項目