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 "No tables in this document,",, "No tables"
Exit Sub
End If
Dim rtt As NotesRichTextTable
i = 0
Do
Set rtt = rtnav.GetElement
i = i + 1
Messagebox "Column count = " & rtt.ColumnCount & Chr(13) & _
"Row count = " & rtt.RowCount,, "Table " & i
Loop While rtnav.FindNextElement
End Sub
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim body As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
Dim rtt As NotesRichTextTable
Dim rtRangeTable As NotesRichTextRange
Dim rtRangeCell As NotesRichTextRange
Dim rtRangePara As NotesRichTextRange
Dim rtNavTable As NotesRichTextNavigator
Dim rtNavCell As NotesRichTextNavigator
Dim cellCounter As Integer
Dim msg As String
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
Set body = doc.GetFirstItem("Body")
REM Find first table in Body item
Set rtnav = body.CreateNavigator
If Not rtnav.FindFirstElement(RTELEM_TYPE_TABLE) Then
Messagebox "Body item does not contain a table,",, _
"Error"
Exit Sub
End If
REM Set up range and navigator for table
Set rtRangeTable = body.CreateRange
Call rtRangeTable.SetBegin(rtnav)
Call rtRangeTable.SetEnd(rtnav)
Set rtNavTable = rtRangeTable.Navigator
REM Find cells in table
Set rtRangeCell = body.CreateRange
Set rtRangePara = body.CreateRange
cellCounter = 0
Call rtNavTable.FindFirstElement(RTELEM_TYPE_TABLECELL)
Do
msg = ""
cellCounter = cellCounter + 1
REM Set up range and navigator for cell
Call rtRangeCell.SetBegin(rtNavTable)
Call rtRangeCell.SetEnd(rtNavTable)
Set rtNavCell = rtRangeCell.Navigator
REM Find paragraphs in cell
Call rtNavCell.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH)
Do
Call rtRangePara.SetBegin(rtNavCell)
msg = msg & rtRangePara.TextParagraph & Chr(13)
Loop While rtNavCell.FindNextElement(RTELEM_TYPE_TEXTPARAGRAPH)
Messagebox msg,, "Cell " & cellCounter
Loop While rtNavTable.FindNextElement(RTELEM_TYPE_TABLECELL)
End Sub