Reputation: 437
I have created a Crosstab report in JasperReports and would like to add some conditional coloring to only the ALL rows and columns.
So far I have attempted to check for the <Measure>_<Column Group>_ALL
variables in a conditional style, but this doesn't work when some of the values are the same as the values in the ALL row/columns.
I am using the ROW_COUNT
variable to do alternating row colors, but I noticed that it doesn't count the ALL row as a discrete row.
Is this possible?
I want the background color for the data in the average columns/rows to be grey in the above example without messing up the alternating row color.
Upvotes: 1
Views: 1746
Reputation: 21710
To set specific style to a column group it needs to be outside of your datasource. Add a crosstabCell
where you set the columnTotalGroup
and on this set style as you like.
jrxml code
<crosstabCell width="50" height="28" columnTotalGroup="myColumnGroup">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="11" width="50" height="16" forecolor="#000000" uuid="27bcff56-8b7a-4867-b1bb-f0f35f750525"/>
<textElement verticalAlignment="Middle">
<font size="8"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$V{myAverage})]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
To get the cell's after the data set totalPosition="End"
on the group
You can apply this also for rows totals using setRowTotalGroup
Upvotes: 1