How to print rows in alternating colours
Prev | Chapter 5. Tips and tricks | Next

## How to print rows in alternating colours

When printing a report it is often wanted to have every second row printed with a different colour to make it easier to read the output. To do so put the following code in the on_print action of a report field

Example 5.10. Printing alternate colours

    if hk_thisreport.datasource().row_position() % 2 ==0:
       hk_this.set_backgroundcolour(hk_white)
    else:
       hk_this.set_backgroundcolour(hk_grey)

Prev | Up | Next
How to format numbers | Home | How to set the focus in a form