你可以嘗試這樣的事情:
<queryString>
<![CDATA[SELECT ... AS paid FROM...]]>
</queryString>
...
<field name="paid" class="java.math.BigDecimal"/>
<variable name="sum" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{paid}]]></variableExpression>
</variable>
...
<detail>
<band height="39" splitType="Stretch">
<textField>
<reportElement x="170" y="15" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{paid}]]></textFieldExpression>
</textField>
</band>
</detail>
...
<summary>
<band height="42" splitType="Stretch">
<textField pattern="$#,##0.00">
<reportElement x="182" y="11" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{sum}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="82" y="11" width="100" height="20"/>
<textElement/>
<text><![CDATA[Total:]]></text>
</staticText>
</band>
</summary>
是否所有細胞的Excel文件(列付費)具有數字格式? –
其字符串格式就像這樣$ 1234.45。在Excel中,單元格不支持字符串。 – java2world