FindFirstElement(RTELEM_TYPE_TABLE) not always working

We have a rather large instalment base of a Notes application to publish webpages. Documents are created in Notes and viewed in a web browser.

From a user perspective it is quiet normal to select content from a website and paste it in Notes. Sometimes the number of nested (more: nasty) tables get’s too large and the document can not be opened anymore in Notes.

I am no expert in rich text but there seem to be some LotusScript methods available to read/write to rich text. For example FindFirstElement:

Moves the current position to the first element of a specified type in a rich text item.

You can supply a parameter, the type of element you are looking for. In my case this would be RTELEM_TYPE_TABLE

So my plan was to navigate through the whole rich text, count the number of  tables, present a dialogue to the user and ask which table(s) may be deleted (in order of appearance in the rich text).

So without removing the complete rich text the user has at least a way to re-cover parts of the document (I notice attachments do not get deleted when calling the remove method on a NotesRichTextTable, as a remove method on a NotesRichTextItem would do).

You can read more details in the Designer help. Look for:

NotesRichTextTable class > Remove method

All nice but during test I noticed some odd behaviour:

  • The method initially could not find ANY table in the rich text:

Messagebox “Body item does not contain a table,”,, “Error”

  • After I attached a file in the table the method seem to be able to discover tables.
  • When I copied the agent from one application to another application it seems to have lost its ability (again) to find elements in rich text . The step to attach a file in a table does not work here.

I also noticed that the method described in previous versions was called getfirstelement, this seems to be renamed in later versions (I am working with 8.5.2).

So I am left in doubt. Surely this is not something I can offer as a function to try to recover rich text.

  • Do you have an alternative approach you can recommend?

Nest-y tables in Lotus Notes

Today appeared an incident on my desk. A customer has problems with the number of nested tables in a rich text field.

It is unclear how they landed in the situation because if I nest some tables in my mail I get the warning:

Nevertheless the customer has a problem that needs to be fixed so I wonder what my options are?

  • Copy the rich text in a memo document and hope for the best that the number of nested tables is equal or less than the maximum number of 8
  • Find a tricky way to navigate through the rich text, grab the table with more than 8 levels and cut off a couple of layers of nested tables untill the maximum number and copy it in a memo document

I guess the last approach is the best one, but the most complicated.

How do you handle exceedings of nested tables?

Link of interest: Idea on IdeaJam.