如何在iReport中设置Excel单元格格式

时间:2011-07-24 10:47:07

标签: export-to-excel ireport cell-formatting

我正在尝试将报告导出为xls,但是当我打开导出的文件时,我注意到所有单元格格式都是数字,所有数据都是用'like text data(整数字段和双字段......)写的所以我不能在Excel中应用任何公式,如SUM。

如何根据我的iReport TextField类表达式保留单元格格式?

我正在使用iReport 4.0.2。

感谢所有人。

2 个答案:

答案 0 :(得分:3)

我一直在寻找同样的问题并找到了以下内容:

http://jasperreports.sourceforge.net/sample.reference/xlsformula/index.html

您可以在ireport的export excel设置下将“检测单元格类型”设置为默认值。

问候

答案 1 :(得分:0)

<textField>元素中使用此:

<reportElement x="0" y="0" width="100" height="20" uuid="fb1a31bf-e600-4ed0-8eb1-2e48f82b90ce">
  <property name="net.sf.jasperreports.export.xls.pattern" value="0.00"/>
</reportElement>

其中value="..."是您的单元格模式。