DynamicJasper doesn't apply conditional styling if the column type is Image. This bug is true for setPrintBackgroundOnOddRows and addConditionalStyle()
If you print out jrxml file the style for image column is missing the conditionalStyle tag.
Ex:
Style oddRowStyle = new Style();
oddRowStyle.setBackgroundColor(Color.LIGHT_GRAY);
oddRowStyle.setTransparency(Transparency.OPAQUE);
FastReportBuilder reportTemplate = new FastReportBuilder();
reportTemplate.setPrintBackgroundOnOddRows(true)
.setPageSizeAndOrientation(Page.Page_A4_Landscape())
.setOddRowBackgroundStyle(oddRowStyle);
AbstractColumn columnSqlServer = ColumnBuilder.getNew().setColumnProperty(columnProperty.getKey(), Object.class.getName())
.setColumnType(ColumnBuilder.COLUMN_TYPE_IMAGE)
.setImageScaleMode(ImageScaleMode.NO_RESIZE)
//.addConditionalStyle(new ConditionalStyle(new FetchCondition(), columnStyle1))
.setStyle(columnStyle)
.setHeaderStyle(headerStyle).build();
from the generated jxml file
<style name="dj_style_3_" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Center" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="Verdana" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false"> <box padding="2"> <pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> </box> </style> <style name="dj_style_4_" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Left" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="Verdana" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false"> <box padding="2"> <pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> </box> </style>column with even odd set
<style name="Verdana_for_column_DJR_3169_COLUMN_1_" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Left" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="Verdana" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false"> <box padding="2"> <pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> </box> <conditionalStyle> <conditionExpression></conditionExpression> <style mode="Opaque" backcolor="#C0C0C0"/> </conditionalStyle> </style> it's missing the tag
where column1Style1 is
Style columnStyle1 = new Style();
columnStyle1.setFont(Font.VERDANA_SMALL);
columnStyle1.setBackgroundColor(Color.LIGHT_GRAY);
if i apply this style un-conditionally it works fine and or if i apply the same to any other column conditionally it works.