large number converted to scientific format by default in csv using jasper report

无人久伴 提交于 2019-12-25 09:27:02

问题


I'm working with jasper reports and in one of the reports a column is getting converted into scientific format by default when I generate the report as csv format.

Below is the snippet of the column from my jrxml:

    <textField pattern="" isBlankWhenNull="true">
        <reportElement x="0" y="0" width="123" height="10" uuid="2eea8416-88ce-459a-a728-8c448690ba62"/>
        <textElement textAlignment="Left">
            <font fontName="SansSerif" size="8"/>
        </textElement>
        <textFieldExpression><![CDATA[$F{cardNum}]]></textFieldExpression>
    </textField>

Below is the code snippet from my java class file, I made the changes based on the solutions I found on the web:

@Override
protected void prepareReportParameters(List recordList, String language) {
    //------get parameters form user input-------------------
    try {
        Locale locale = new Locale(language);
        ResourceBundle rb = ResourceBundle.getBundle("jasperproperties/dealertransactionreport/DealerTransactionReport", locale);
        reportParameters.put("REPORT_RESOURCE_BUNDLE", rb);
        reportParameters.put("jasperPath", path);
        reportParameters.put("recordCount", recordList.size());
        reportParameters.put("startDate", formatDate.parse(getParam("jrs.param$p_startDate")));
    reportParameters.put("endDate", formatDate.parse(getParam("jrs.param$p_endDate")));
        reportParameters.put("displaytcktNum", false);
        reportParameters.put("printDate", new Date());
        reportParameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
        reportParameters.put( JRXlsExporterParameter.IS_DETECT_CELL_TYPE,Boolean.FALSE);
        reportParameters.put( JExcelApiExporterParameter.IS_DETECT_CELL_TYPE,Boolean.FALSE );
        doExportBandsValue();

    } catch (Exception e) {
        log.error("ERROR:" + e, e);
    }
}

As seen above, I have added the "JRXlsExporterParameter" & "JExcelApiExporterParameter" properties and set them as false to fix the issue but I'm still seeing the scientific notation instead of the complete number. How can I fix this issue?.

Below is what I'm seeing when I generate a report:

来源:https://stackoverflow.com/questions/44504443/large-number-converted-to-scientific-format-by-default-in-csv-using-jasper-repor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!