例: RemoveRow method

  1. 次のエージェントは、現在の文書の [本文] フィールド内で最初の (または唯一の) 表を取得し、最後の行を削除します。

    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
      Messagebox "Row count = " & rtt.RowCount,, _
      "NotesRichTextTable"
      REM  Call rtt.RemoveRow
      Call rtt.RemoveRow(1, 1)
      Call doc.Save(True, True)
      Messagebox "Row count = " & rtt.RowCount,, _
      "NotesRichTextTable"
    End Sub
  2. 次のエージェントは、現在の文書の [本文] フィールド内で最初の (または唯一の) 表を取得し、最後の 2 行を削除します。

    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
      Messagebox "Row count = " & rtt.RowCount,, _
      "NotesRichTextTable"
      Call rtt.RemoveRow(2, rtt.RowCount - 1)
      Call doc.Save(True, True)
      Messagebox "Row count = " & rtt.RowCount,, _
      "NotesRichTextTable"
    End Sub