如果所有值都为空,我想在jasper表中打印空行。设置字段属性空白时和删除行时空白为true对我不起作用,表中还有属性删除行空白时设为true。
以下是我的报告定义:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="8e8d2e06-defe-4759-b65d-0438240d3b54">
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="TabDS" uuid="a96780df-2bfa-488b-ae8f-02bca8eed34b">
<queryString>
<![CDATA[select 'HI' AS GREETING,TAX from list_vat --statement returns some rows and I would like to surpress printing lines with value = 0]]>
</queryString>
<field name="GREETING" class="java.lang.String"/>
<field name="TAX" class="java.math.BigDecimal"/>
</subDataset>
<queryString>
<![CDATA[SELECT DUMMY FROM DUAL -- DUMMY SQL STATEMENT JUST BE ABLE TO FILL THE TABLE]]>
</queryString>
<field name="DUMMY" class="java.lang.String"/>
<title>
<band height="79" splitType="Stretch">
<componentElement>
<reportElement key="table" style="table" x="0" y="0" width="555" height="13" isRemoveLineWhenBlank="true" uuid="9ae0840f-5051-447e-9072-7e5706b2dc02"/>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="TabDS" uuid="ef2dba26-e5bb-4ebf-885d-4c44bdc1306a">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="90" uuid="c7995020-03e6-45bd-a287-889af0d312c2">
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="90" height="20" isRemoveLineWhenBlank="true" uuid="0b14de63-e049-48da-850b-a6d92f19a7d2"/>
<textFieldExpression><![CDATA[($F{TAX}.compareTo(BigDecimal.ZERO)==0 ? null :$F{TAX})]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</title>
</jasperReport>