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?