Excel Cell Format in JasperReport Report

后端 未结 4 1844
一向
一向 2021-01-05 11:01

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

相关标签:
4条回答
  • 2021-01-05 11:21

    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.

    0 讨论(0)
  • 2021-01-05 11:21

    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 .

    0 讨论(0)
  • 2021-01-05 11:24

    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.

    0 讨论(0)
  • 2021-01-05 11:32

    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....

    0 讨论(0)
提交回复
热议问题