Jump to content
We've recently updated our Privacy Statement, available here ×
  • Wrong BigDecimal Report Parameter Value in MS Excel Export


    asimkin
    • Features: Exporters, Parameters, Reports Version: v7.3 Product: JasperReports® Library

    Issue Description

    User developed a report with a java.math.BigDecimal parameter.

    If he runs the report and passes parameter value like 123456789012345.356, it is displayed properly in the report,

    but export to MS Excel contains incorrect value 1234567891012350.

    What's the reason and how to fix it?


    Resolution

    The issue related to limit of MS Excel.

    In Excel the maximum number of digits allowed in a number is 15.

    Please check the doc below for more details:

    https://support.office.com/en-us/article/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3

    The problem in this case is that also when you use the ##0.0E format pattern for this number, some precision is lost, due to the max number of digits limitation.

    A possible workaround is to disable cell type detect for the report and the value will be treated as a String value, instead of Numeric:

    add proprerty

    net.sf.jasperreports.export.xls.detect.cell.type

    with false value at the report level.


    AS-20190912, case #01793284


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...