I have searched the forum and cant seem to get a good answer. I am creating a dynamic table and would like to add some color to the background.
Is there a way to set the background color for a table, or are you able to set two styles like
rttable.Style = TABLESTYLE_ALTERNATINGROWS &
rttable.Style = TABLESTYLE_TOP
Basically I would like to have the header row a one color and then have alternate colors for the data rows. I would be okay with using images if I had to but not sure that is an option either.
I read about the DXL options but I am not that familar with DXL and I have all the code written, minus the bg color using this method.
There is no table style that lets you select three colors (header, odd, even) so you can can only do this using a cell background color. However, the NotesRichText… classes don’t support setting cell color.
You can use DXL to do this, but I find it’s easier to manually create one copy of the table you need and put it on a page design element or in a rich text field in a profile document. Then you can use AppendRTItem to copy it and it to the rich text you’re creating. This is a lot simpler if you use the ReportGenerator class which you can get from openntf.org. It directly supports using pages to store your tables, and indirectly supports other techniques by giving a function that lets you pass in rich text items that contain starter tables. The sample table agent in the download creates exactly the kind of table you’re talking about, and the code is only about 20 lines, which you can copy and adapt.