Hi there,
I have a form with a RichText Item. Within this item there is a manual-created table.
When I try to access the table-cells with LotusScript I don’t get a reference to the TableObject. (rtnav will not be set)
If I create the table through script as well, it works perfect.
When I take a look at the Item-properties, the tables look different.
Example-tables:
Table 1: (works)
A1 B1
A2 B2
Table 2: (won’t work)
A1
B1
A2
B2
Question1:
Why do the tables look so different?
Question2:
How can I solve this problem and get access to the values ?
Example code:
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
Dim rtrange As NotesRichTextRange
Set rtrange = rti.CreateRange
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
firstFlag = True
For i& = 1 To rtt.RowCount
For j& = 1 To rtt.ColumnCount
If Not firstFlag Then
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Else
firstFlag = False
End If
Call rtrange.SetBegin(rtnav)
Messagebox rtrange.TextParagraph,, _
"Row " & i& & _
", Column " & j&
Next
Next
End Sub
THANKS
Patrick