【问题标题】:How to export jasper report to excel formatting fields如何将碧玉报告导出到excel格式字段
【发布时间】:2017-10-05 20:47:17
【问题描述】:

我有一个输出到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 中的数字类型单元格的任何方法?是否可以进行这种转换?

【问题讨论】:

  • 导出xls或xlsx后添加再试试。
  • 我试过了,但 BigDecimal 类型继续发短信。我几乎要放弃了。
  • 您是否在列中使用了数字模式?如果没有,请尝试应用数字格式,然后使用属性。
  • 不,我不使用任何模式,我现在就试试!
  • 显示在excel中显示不正确的textField的jrxml,可能你在textField表达式中将其格式化为String。

标签: jasper-reports export-to-excel


【解决方案1】:

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

我的代码:

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

【讨论】:

    猜你喜欢
    • 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
    相关资源
    最近更新 更多