Friday, March 10, 2023

Jasper report - Export to excel force cell to convert as text.

Issue: some cell having numeric value like field name is TRANSACTION_ID and suppose value is like 1545789348775194 then it auto convert to 4548766+15 something like scientific notation once you click on cell and focus out so below jasper export to excel property help to set the cell property type = text.

The issue is now fixed and will be part of the next JasperReports release.

To have cells set as Text type in Excel, you need to set the following property for that element:

<property name="net.sf.jasperreports.export.xls.pattern" value="@"/>

Also, if the net.sf.jasperreports.export.xls.detect.cell.type property is set to false, the cell type will be set as Text.