Clarity

Expand all | Collapse all

Export JasperSoft into Excel

  • 1.  Export JasperSoft into Excel

    Posted 09-20-2016 03:59 PM

    Why am I not able to export the formulas from JasperSoft report into Excel?  I've tried the various formats for exporting a JasperSoft report, but the formulas do not export making it difficult to manipulate the data in Excel.  Any help would be appreciated. Thank you.



  • 2.  Re: Export JasperSoft into Excel

    Posted 08-02-2017 05:58 AM

    The formula expression expected by third party APIs used to export reports in Excel format should not contain the "=" sign.
    Try to use

    <property name="net.sf.jasperreports.export.xls.formula" value="A1"/>

    If you need to write a dynamic formula expression, you have to use the <propertyExpression> tag.

    The other common mistake which destroys any good and reliable result of a formula occurs when we are not explicitely instruct the exporter to detect the cell type.
    By default, keeping in mind the importance of the text formatting, all cells are assumed to hold String objects within. When you need to apply a formula, Excel should know that you are talking about numbers there, and that's why you have to tell it about.
    There are 2 possibilities to enable the cell type detection:
    1. Use the general export property net.sf.jasperreports.export.xls.detect.cell.type and set it to "true" in your report
    2. Use the JRXlsExporterParameter.IS_DETECT_CELL_TYPE export parameter, and set it to Boolean.TRUE in your code.