More Lotus Notes table problems

Sort of an addition to my previous post, Notes doesn’t like large tables being created with AppendTable().

You get this error “Illegal column width – check Left and Right margins”. The work around is to create the table with only one row and the desired columns and then use AddRow() to add up to 255 rows.

See the IBM technote for more infomation.

Hard limit on Lotus Notes rich text table rows

Some times Lotus Notes frustrates the hell out of me. Someone decided that it would be a good idea to put a hard limit (or at least a tiny limit) on the number of rows that a table can have

I’m not using composite applications introduced in Lotus Notes 8, I assume it handles this kind of thing a lot better. But the java client is to heavy weight and all our database (Applications) and they use the standard design elements anyway.

If you try and create a table with more than 255 rows you will get the error:

“Table can have only 255 rows”

List of Domino limits

Solution:
The solution is to basically keep creating new tables when you hit the row limit. The only problem is that it creates a gap between the tables which may mess up the layout a little.

Here is a simple function I wrote to break up an array into multiple tables if there are to many rows and add it to rich text field

rtField – the field you want to add the tables to
tableData – a 2D array that gets converted into a table (this holds the table data)
rows – the number of rows in the tableData array
cols – the number of columns in the tableData array

Sub CreateTable(rtField As NotesRichTextItem, tableData As Variant, rows As Integer, cols As Integer)
    numFullTablesToAdd% = 0
    numFullTablesToAdd% = Fix(rows/255)
    ‘add tables first
    For i%=1 To numFullTablesToAdd%
        Call rtField.AppendTable(255, cols) ‘ max row tables
    Next   
    Call rtField.AppendTable(rows Mod 255, cols) ‘ whats left
    Dim rtnav As NotesRichTextNavigator
    Set rtnav = rtField.CreateNavigator
    ‘Dim rtTable As NotesRichTextTable
    Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
    For r%=0 To rows-1
        For c%=0 To cols-1
            Call rtField.BeginInsert(rtnav)
            Call rtField.AppendText(tableData(r%, c%))
            Call rtField.EndInsert
            Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
        Next
    Next
End Sub

There maybe a way to instead create a table with HTML but I haven’t worked out out yet. Will update if I find a better solution