How to Change the Color of Cells in a Spreadsheet

Previous Next

You can set the foreground, background and font property of individual cells in a spreadsheet look window. This is implemented in the same way as for column based windows.

To do this, open the window class, and add an extra query with the following syntax (substitute your own values for the <variable> elements):

SELECT 'x' FROM <main_table> WHERE <col> = <value>

 

Yes-action: query.<col>.CurrentField.foreground('green')  

No-action: query.<col>.CurrentField.foreground('red')

 

When the value in the extra query is matched, the foreground color will be green, otherwise it will be red. You can use the same procedure for the background color or the font of the text in the cell.