I\'m working on JasperReport Report that generates Excel file. For some reason my cell formats/types are not how they should be. For example I have Date object in my cell bu
The problem is/was that because I'm using POI 3.5 and JasperReports 3.7.0 and Generating XLSX Excel format. POI 3.5 will be supported in JasperReports 3.7.1 (or just get snapshot from SVN). So what I did I just went back to the old Excel type (xls) file and it worked perfect.
Just FYI
setParameter(JRXlsExporterParameter.IS_AUTO_DETECT_CELL_TYPE, Boolean.TRUE);
or IS_DETECT_CELL_TYPE, Boolean.TRUE
is the one which makes the Date to change to number .
In new version of JasperReports
the parameter net.sf.jasperreports.export.xls.pattern
was introduced.
The sample:
<textField pattern="EEE, MMM d, yyyy">
<reportElement x="100" y="12" width="75" height="11">
<property name="net.sf.jasperreports.export.xls.pattern" value="ffffd, mmm d, yyyy"/>
</reportElement>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.sql.Timestamp"><![CDATA[$F{dateField}]]>
</textFieldExpression>
</textField>
Information about this parameter is here. The sample of using is here.
JasperReports version 4.1.1 net.sf.jasperreports.export.xls.pattern was introduced.
check here
In properties expressions
properties name >> net.sf.jasperreports.export.xls.pattern
properties value >> @ for text, yyyy-mm-dd for date format, #,##0.00;-#,##0.00 for currency, etc....