Jump to content
Changes to the Jaspersoft community edition download ×

XLSX file missing excel formulas


klaytoncbrito
Go to solution Solved by Rutuja Bhalchandra Shinde,

Recommended Posts

Hello,

 

I'm working on a legacy project and I'm having an issue with exporting XLSX file format using Jasper Library, where the resulting XLSX file doesn't have any excel formulas.

I've tested changing the Java code to export to XLS and It works, the XLS file has the excel formulas.

The project I'm working on use the Jasper of version 3.7.3. 

But I really need to export XLSX instead of XLS.

XLSX file with missing formulas:
converted-file.png.4a316d9197c7ff6e2f996bf483c9b7be.png

XLS file with formulas:
converted-file.png.b7c1a944ea24a62e14b348e0283583b9.png

JRXML field:

            <textField isBlankWhenNull="true">
                <reportElement mode="Opaque" x="229" y="0" width="50" height="12" backcolor="#E6E6E5">
                    <propertyExpression name="net.sf.jasperreports.export.xls.formula"><![CDATA["=A1"]]></propertyExpression>
                </reportElement>
                <box>
                    <bottomPen lineWidth="1.0" lineStyle="Solid"/>
                    <rightPen lineWidth="1.0" lineStyle="Solid"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle" lineSpacing="Single">
                    <font fontName="Monospaced" size="8" isBold="true" pdfFontName="Courier-Bold"/>
                </textElement>
            </textField>
 

Java code:
 

            final var jasperPrint = JasperFillManager.fillReport(jasperTemplate, parameters, dataSource);

            final var xlsxExporter = new JRXlsExporter();
            //final var xlsxExporter = new JRXlsxExporter();
            xlsxExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
            xlsxExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, output);
            xlsxExporter.setParameter(JRXlsAbstractExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);

            xlsxExporter.exportReport();
 

I'm also using: <property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>

UPDATE

I've talked with my boss and between update the jasper version or using XLS they chose using XLS

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images


Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.

Link to comment
Share on other sites

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