Alternate row colors

General TRichView support forum. Please post your questions here
Post Reply
ccr
Posts: 8
Joined: Sat Nov 13, 2010 12:47 am

Alternate row colors

Post by ccr »

hello,
the new versions of trichviewedit support alternate table row colors which is a very nice feature.
my application is a reportdesigner where the users can create a report themselves, also containing tables. the columns of the tables are often bound to a database field.
when executing the report these tables are filled with database rows. now comes the important part:
when filling the cell value the style is taking over from the style in the first row of the same column via

Code: Select all

AddTextNL
however with this approach the table rows are not drawn with alternating background anymore.
somehow the cell style seems to override the row behaviour.
what is the best way to combine the styles (or the achieve alternate row coloring in this case)?

thank you
Sergey Tkachenko
Site Admin
Posts: 17236
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Alternate row colors

Post by Sergey Tkachenko »

Sorry, I do not understand the problem.

If you define Cell.Color, it really overrides all cell colors defined in the Cell's Table (including alternate row colors).

But styles of text and paragraph cannot override cell colors. Text and paragraphs can have colored background, but it is drawn on top of cells, so you can see a cell color at least in a cell padding area.
ccr
Posts: 8
Joined: Sat Nov 13, 2010 12:47 am

Re: Alternate row colors

Post by ccr »

thank you for the quick response sergey,
it might well be my programming mistake - still searching for it.
the flow is as follows:
the table has alternate row colors defined. per record in a dataset a row is inserted and for each cell a value is set
with this:

Code: Select all

with oTable.Cells[oTable.RowCount - 1, i] do
    AddTextNL(cCellText, GetRVData.GetItemStyle(0), -1, GetItemPara(0));
something in there must make the alternate rows disappear. remark: after processing all records, the second table row is deleted (it contained the dataset-fieldname and the cell style template). the procedure is finished with

Code: Select all

RichViewEdit.Format
Sergey Tkachenko
Site Admin
Posts: 17236
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Alternate row colors

Post by Sergey Tkachenko »

AddTextNL or any other modification of cell context does not change cell color.
There must be another reason.
Check that Cell.Color = clNone for all cells. If a cell has a color defined, it will be used.
ccr
Posts: 8
Joined: Sat Nov 13, 2010 12:47 am

Re: Alternate row colors

Post by ccr »

hello sergey,
after checking for some time now the strange thing seems that the Table.Even|OddRowColors are not stored in the database at all.
when i set this info in the designer to (let's say) clYellow, close the dialog and open the table properties - it is shown.
however when i save the document and reload it from the database it is not shown.
it is saved as rtf. do i have to set some special properties?
Sergey Tkachenko
Site Admin
Posts: 17236
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Alternate row colors

Post by Sergey Tkachenko »

In the current version, these properties cannot be stored in RTF. It's not simple to store it in RTF, we have to implement table styles to do it. It is planned, but not in near future, sorry.
Post Reply