register log on
Knowledge base

Specifying custom style for Arnica WebReport cells

KB Artcile # 2624
To specify context-sensitive style for a WebReport cell, you may use industry standard CSS-based attributes included in the inline style of the cell.  In this example, content of the OrderAmount column is designed  to appear in different color and style (black, green, red, highlighted, or bold) depending on cell value.First, select the column from report output column list:

Then, set style definition type to "Script", save changes and go to script properties page:

On the style script page, enter the following Arnica script code and and save changes:

do case
  case sourcedata.orderamount < 1000
    return 'style="text-align:right;"'
  case sourcedata.orderamount < 2000 and sourcedata.orderamount >= 1000
    return 'style="text-align:right;color:green"'
  case sourcedata.orderamount < 3000 and sourcedata.orderamount >= 2000
    return 'style="text-align:right;color:red"'
  case sourcedata.orderamount < 4000 and sourcedata.orderamount >= 3000
    return 'style="text-align:right;color:red;font-weight:bold;"'
  case sourcedata.orderamount >= 4000
    return 'style="text-align:right;color:red;font-weight:bold;background-color:yellow;"'

return 'style="text-align:right;"'

Run the report, the style of the OrderAmount column content should change depending on the value: