开发者

export jasper report to excel - 2003, 2007

I have created one jasper report with column paid which contains decimal values (format by new DecimalFormat("$#,##0.00").format($F(paid)) ). In the bottom o开发者_运维百科f the report I generated total balance for that paid column. When I want to export report to excel it gives the sum problem. In the excel sheet the sum is not displayed (due to new DecimalFormat("$#,##0.00").format($F(paid)) it is returns String value). So, anyone please give me the solution. I want to display the sum of the paid values in excel.

thanks & regards srinivas


You can try something like this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜