Bug or Problem ? --> Access a Table within a RichText Item through LotusScript?

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

Subject: Bug or Problem ? → Access a Table within a RichText Item through LotusScript ?

Likely answer:

Your rich text item is inside a table cell on the form (or inside a header section of the form). When saved, a table inside a table is a “nested table”, which doesn’t look any different, but which uses different signatures in the rich text for backward compatibility. The standard LotusScript classes don’t handle nested tables. When you create through LotusScript, it always creates a table with standard table signatures, but if you resave with the form you have, they are altered to nested table signatures.

Choices:

a) Take the rich text field out of the table on the form, or

b) Process the rich text with DXL, which is more work but will let you access nested tables, or

c) Buy a more powerful rich text toolkit such as our Midas Rich Text LSX that handles nested table and much more.