如何将jasper报告导出到Excel格式化字段

时间:2017-10-05 20:47:17

标签: jasper-reports export-to-excel

我有一个输出到excel的jasper报告,但"java.math.BigDecimal"值显示为文本。

我已尝试使用此类属性,但仅将"java.lang.Double""java.lang.Integer"值转换为数字,"java.math.BigDecimal"字段继续显示为文本。

<property name="net.sf.jasperreports.export.detect.cell.type" value="true"/>

有没有人知道将这种类型的字段"java.math.BigDecimal"转换为excel中的数字类型单元格的方法?是否可以进行此转换?

1 个答案:

答案 0 :(得分:1)

我解决了我的问题 用java中的一行。我不知道为什么,但我在java中将 DetectCellType 更改为true,现在可以正常工作。

我的代码:

        JRXlsExporter xlsExporter = new JRXlsExporter();
        SimpleXlsReportConfiguration xlsReportConfiguration = new SimpleXlsReportConfiguration();
xlsReportConfiguration.setDetectCellType(true);
            xlsExporter.setConfiguration(xlsReportConfiguration);