如果列类型为Image,则DynamicJasper不应用条件样式

时间:2014-03-04 23:47:16

标签: java jasper-reports dynamic-jasper

如果列类型为Image,则DynamicJasper不应用条件样式。这个错误适用于setPrintBackgroundOnOddRows和addConditionalStyle()

如果打印出jrxml文件,则image的样式列缺少conditionalStyle标记。

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();

来自生成的jxml文件

<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>

具有偶数组的列

<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><![CDATA[new java.lang.Boolean(((Number)$V{REPORT_COUNT}).doubleValue() % 2 == 0)]]></conditionExpression>
        <style mode="Opaque" backcolor="#C0C0C0"/>
    </conditionalStyle>
</style>

它缺少标签

0 个答案:

没有答案