Jasper reports textField正在忽略显示货币合计的模式
我有一个变量Jasper reports textField正在忽略显示货币合计的模式,jasper-reports,Jasper Reports,我有一个变量V{Total}其中模式###0.00未应用,我缺少什么 您正在尝试格式化字符串: $V{Total}+“-€”将是一个字符串,即使变量是十进制的,添加-€将把它转换为字符串,这意味着您的格式设置将不起作用 您需要自己设置值的格式并添加尾随字符,请尝试以下操作: new DecimalFormat("###0.00").format($V{Total})+".- €" 完整解决方案: <textField isBlankWhenNull="false"> <
V{Total}
其中模式###0.00
未应用,我缺少什么
您正在尝试格式化字符串:
$V{Total}+“-€”
将是一个字符串,即使变量是十进制的,添加-€
将把它转换为字符串,这意味着您的格式设置将不起作用
您需要自己设置值的格式并添加尾随字符,请尝试以下操作:
new DecimalFormat("###0.00").format($V{Total})+".- €"
完整解决方案:
<textField isBlankWhenNull="false">
<reportElement uuid="ea9933c9-1863-474f-a6e2-65cfe3f07426" x="390" y="9" width="144" height="20" forecolor="#000000"/>
<box>
<pen lineColor="#999999"/>
<topPen lineColor="#999999"/>
<leftPen lineColor="#999999"/>
<bottomPen lineWidth="0.5" lineColor="#999999"/>
<rightPen lineColor="#999999"/>
</box>
<textElement>
<font fontName="Verdana" isBold="true" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[new DecimalFormat("###0.00").format($V{Total})+".- €"]]></textFieldExpression>
</textField>
优秀的,你可以考虑接受上面的答案,帮助其他用户知道谁绊倒了。