Changes the text color of the specified table cells.
Syntax
table_name.settextcolor(cell_range) color_arg
where
cell_range describes the table cells to be modified, and
color_arg specifies the color to be applied to the text in the cells. See
Table::setfillcolor for the syntax for
cell_range and
color_arg.Examples
To set an orange text color for the cell in the second row and sixth column of TAB1, you may use:
tab1.settextcolor(f2) @rgb(255, 128, 0)
tab1.settextcolor(2,f) @HEX(ff8000)
tab1.settextcolor(2,6) orange
tab1.settextcolor(r2c6) orange
You may also specify a blue color for the text in an entire column, or an entire row,
tab1.settextcolor(C) @RGB(0, 0, 255)
tab1.settextcolor(2) blue
or a green color for the text in cells in a rectangular region:
tab1.settextcolor(R2C3:R3C6) green
tab1.settextcolor(r2c3,r3c6) green
tab1.settextcolor(2,C,3,F) @rgb(0, 255, 0)
tab1.settextcolor(2,3,3,6) @HEX(00ff00)
You may also conditionally set the text color for a range of cells. For example, cell d3 will be set to red if cell b4 plus c4 is greater than cell d4 minus e4, and similarly for cells d4 to d18.
tab1.settextcolor(d3:d18 if [b4:b19]+[c4:c19] > [d4:d19]-[e4:e19]) red
This also works for fixed columns and rows. To set the text color for the cells a13 to b18 to red if the matching cells from the fixed column B (cells b4 to b9) are greater than 0.5:
tab1.settextcolor(a13:b18 if [b4:b9] > .5) red
This sets the text color for the cells e13 to f18 to orange if the matching cells from fixed row 4 (cells b4 to c4) are greater than 0.5. Specifically, the text color of cells e13 through e18 will be orange if cell b4 is greater than 0.5, and the text color of cells f13 through f18 will be orange if cell c4 is greater than 0.5:
tab1.settextcolor(e13:f18 if [b4:c4] > .5) orange
Cross-references
See
Table::setfont and
Table::setfillcolor for details on changing the text font and cell background color.
For additional discussion of table commands see
“Working with Tables and Spreadsheets”.
See also
“Table and Text Objects” for a discussion and examples of table formatting in EViews.