RE: Need help with table attributes in LotusScript Kenneth Haggman 28.Sep.11 11:04 AM a Web browser Applications Development 6.5.5Windows XP
After having 'dabbled' with tables and LotusScript many times I now always use the following approach when I need the tables to be more than stock-standard tables.
1. Use 'seed' tables. Have a view in some database containing records with tables formatted the way you want them. The cells can be empty but the table can have exactly the formatting you want.
2. In your code, look up the seed tables you need and append them to your RT-items. Once you have appended a table you can access it to add your data to the cells. You can add rows as well keeping the existing table formatting.
3. I have often found that you need to save and re-reference the document you are adding tables to in order to really get what you want. And when you re-reference you MUST use a view.
For example:
'-- Start creating your new document.
Set docNew = db.CreateDocument
Set rtBody = New NotesRichTextItem(docNew, "Body")
...
'-- Lookup the seed table document. Append it.
Set docSeed = viewSeed.GetDocumentByKey("some key", True)
Set rtSeed = docSeed.GetFirstItem("SeedBody")
Call rtBody.AppendRTItem(rtSeed)
'-- Now save and re-reference.
'-- You will need a view listing all docs by UNID.
Call docNew.Save(True, False)
strUNID = docNew.UniversalId
Set docNew = Nothing
Set docNew = viewAll.GetDocumentByKey(strUNID, True)
Now you have a properly formatted table in your document.
You may find you need to save and re-reference even after such simple operations as adding data to cells.
Test, test and test again.