Overview
Problem
When creating a report in FineReport, you may often encounter the situation where cells/rows/columns need to be displayed in different background colors under certain conditions. So, how can you achieve this effect?
Solution
You can add the Background attributes in Condition Attribute to achieve the effect.
The background setting of Current Cell, Current Row, and Current Column follows the same principle. In this document, Current Cell and Current Row are selected to set the background color as examples for explanation.
Example One: Current Cell
Data Preparation
Create a general report, and create a built-in dataset, E-Commerce Sales Proportion, which records the sales proportion of different products across various e-commerce platforms.

Table Design
Right-click cell A2, choose Cell Element > Insert Slash, enter E-Commerce|Product, and select Diverge from Top Left to Bottom Right. Enter e-commerce platform names in cells B2 to M2, and drag the data columns into corresponding cells A3 to M3. The following figure shows the table design.

Note:Condition Attribute Adding
Select cells B3 toM3, add a Background condition attribute, click Edit to select a color, and select Current Cell from the drop-down list.
Set the conditions for this condition attribute to take effect: Set Type to Common, select Double from the drop-down list, and select AND to connect the two conditions, currentValue Greater than/Equal to 0.5 and currentValue Less than 0.7.

Add six condition attributes in sequence, as shown in the following table.
| Condition Attribute | Condition |
|---|---|
Condition Attribute 1 | currentValue Greater than/Equal to 0.5 and currentValue Less than 0.7. |
Condition Attribute 2 | currentValue Greater than/Equal to 0.3 and currentValue Greater than/Equal to 0.5. |
Condition Attribute 3 | currentValue Greater than/Equal to 0.1 and currentValue Less than 0.3. |
Condition Attribute 4 | currentValue Greater than/Equal to 0.05 and currentValue Less than 0.1. |
Condition Attribute | currentValue Greater than/Equal to 0 and currentValue Less than 0.05. |
Condition Attribute 6 | currentValue Equal to 0.0. |
Note:Effect Display
PC
Save the template, and click Pagination Preview. Cell data in different ranges will be displayed in different colors with the same effect as the heatmap, as shown in the following figure.

Mobile Terminal
The template can be previewed on both the DataAnalyst app and the HTML5 terminal. The following figure shows the effect.

Example Two: Current Row
Data Preparation
Create a general report, and create a database query ds1 with the SQL statement SELECT * FROM Sales_Volume.

Table Design
Drag all fields into cells, set corresponding titles, and set Data Setting to List for cell A2, as shown in the following figure.

Condition Attribute Adding
Select cell A2, click Condition Attribute on the right side, add a condition, select Background from the drop-down list of Attribute, click Edit, select a color, and select Current Row from the drop-down list.
Set Formula Condition to Formula, click Define, and enter the formula: E2 >= 500, which indicates that when the sales volume is greater than 500, the current row will be displayed in green, as shown in the following figure.

Effect Display
PC
Save the report and click Pagination Preview. The following figure shows the preview effect.

Mobile Terminal
The template can be previewed on both the DataAnalyst app and the HTML5 terminal. The following figure shows the effect.

Template Download
For details, you can download the templates
Different Cell Background Colors by Condition.cpt
Different Background Colors of the Current Row by Condition.cpt.