Search code examples
jasper-reportsexport-to-excel

How to export jasper report to excel formatting fields


I have a jasper report with output to excel, but the "java.math.BigDecimal" values ​​are displayed as text.

I already tried to use the property such but converted only the "java.lang.Double" and "java.lang.Integer" values ​​to numerical, the "java.math.BigDecimal" fields continue to be displayed as text.

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

Does anyone know of any way to convert this type of field "java.math.BigDecimal" to a numerical type cell in excel? is it possible to do this conversion?


Solution

  • I solved my problem with a line in java. I don't know why, but i change DetectCellType to true in java and now works.

    My code:

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