Change cells design according to data

Hi!

I'm trying to change the color of some table cells, according to the value of the data in it.
For example, if I have a table with numbers, I want only the cells with values higher than 100 to be red, or write red "!" next to the value.

I tried to do something like this (just as a proof of concept)

report.Load("repory.frx");
report.RegisterData(data, "Data");
TableObject table = (TableObject)report.Pages[0].ChildObjects[2].ChildObjects[0];
TableRow row = table.Rows[0];
TableCell cell = (TableCell)row.ChildObjects[0];
cell.GetData();

now I'm supposed to have the data, but I'm not really sure I can access it or change something in the specific cells design.

Any suggestions?
Thanks

Comments

  • edited August 2009
    Hello,

    If you want to change the color only, use the conditional highlight feature. It is described in the user's manual, "Report creation/Formatting/Conditional highlighting" chapter. This chapter describes the Text object, but it applies to table cell too.
  • edited 8:35PM
    AlexTZ wrote: »
    Hello,

    If you want to change the color only, use the conditional highlight feature. It is described in the user's manual, "Report creation/Formatting/Conditional highlighting" chapter. This chapter describes the Text object, but it applies to table cell too.

    Thanks.
    But can I change the color of just part of the cell text (like in the example I gave, draw red "!" next to the text?
    And in general, can I access the table cell's data from the code, and modify the cell accordingly?

    Thanks Again >
  • edited 8:35PM
    It's a bit harder, but still possible. See the example attached (you can open it in the Demo.exe).
    - set cell's HtmlTags property to true;
    - write an event handler for the cell's AfterData event (see the Code tab).

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.