【问题标题】:export jasper report to excel - 2003, 2007将碧玉报告导出到 excel - 2003、2007
【发布时间】:2011-09-16 11:37:29
【问题描述】:

我创建了一份碧玉报告,其中付费列包含十进制值(格式为 新的 DecimalFormat("$#,##0.00").format($F(paid)) )。在报告的底部,我为该付费列生成了总余额。当我想将报告导出到 excel 时,它给出了总和问题。在 excel 表中,不显示总和(由于 new DecimalFormat("$#,##0.00").format($F(paid)) 它返回字符串值)。所以,请任何人给我解决方案。我想在excel中显示支付值的总和。

感谢和问候 斯里尼瓦斯

【问题讨论】:

  • Excel 文件中的所有单元格(在付费列中)是否都是数字格式?
  • 它是一个像 $1234.45 这样的字符串格式。在 excel 中,单元格不支持字符串。

标签: jasper-reports


【解决方案1】:

你可以试试这样的:

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

【讨论】:

  • 非常感谢您的帮助
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多