Free Support Forum - aspose.com

Use ACXlsExporter to export excel file using Aspose.Cells for JasperReports

Hi,

I am using the aspose jasperreport combined with aspose cell to generate a editable chart in excel (Java program). The version is aspose-cells-17.9 .jar. I have downloaded the demo and try to edit the code for testing. But I found that there is exception thrown when using ACXlsExporter exporter = new ACXlsExporter();

Exception in thread “main” java.lang.NoSuchFieldError: maxColumnIndex
at com.aspose.cells.jasperreports.ACXlsExporter.(Unknown Source)
at com.aspose.cells.jasperreports.ACXlsExporter.(Unknown Source)
at hk.judiciary.rpt.model.application.biz.ChartsApp.cellsReport(ChartsApp.java:250)
at hk.judiciary.rpt.model.application.biz.ChartsApp.main(ChartsApp.java:186)

I have tried different version of jasperreport and seems the maxColmnIndex is removed after jasperreports-6.2.1.jar. But when I use 6.2.1 or earier version. NoClassDefFoundError is thrown.

Exception in thread “main” java.lang.NoClassDefFoundError: net/sf/jasperreports/charts/util/DrawChartRendererImpl
at hk.judiciary.rpt.model.application.biz.ChartsApp.cellsReport(ChartsApp.java:250)
at hk.judiciary.rpt.model.application.biz.ChartsApp.main(ChartsApp.java:186)
Caused by: java.lang.ClassNotFoundException: net.sf.jasperreports.charts.util.DrawChartRendererImpl
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 2 more

Please let me know how to fixed it. Thanks.

@alexhk2018,

Thanks for the error trace and details.

I have logged a ticket with an id “CELLSJR-2” for your mentioned issue. We need to evaluate your issue thoroughly. Please spare us little time, so we could look into your issue and figure it out soon.

@alexhk2018,

Please try our latest version/fix: Aspose.Cells for JasperReports v2.0.0:
https://downloads.aspose.com/cells/jasperreports/new-releases/aspose.cells-for-jasperreports-2.0.0/

Our latest release Aspose.Cells for JasperReports v2.0.0 is based on JasperServer v6.3.0. We have checked the maxColumnIndex field and can confirm its existence in it.

Hi Amjad_Sahi,
ACXLSExporter is only supporting to generate .xls report not .xlsx report. Can you please help me on this.

@J1111111,

See the other thread for reply:

Thank you very much Amjad_Sahi for your prompt reply !!
Now I am able to generate .xlsx file but when the jrxml file is containing more than 255 columns then I am getting the following exception. It is happening because ACXlsExporter is supporting to generate the report with 255 columns. So can you please help me on this.

java.lang.IllegalArgumentException: Invalid column index.
at com.aspose.cells.anz.a(Unknown Source)
at com.aspose.cells.ccy.a(Unknown Source)
at com.aspose.cells.jasperreports.ACXlsExporter.setFreezePane(Unknown Source)
at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportSheet(JRXlsAbstractExporter.java:1282)

@J1111111,

Could you provide us .jrxml and data xml files and sample code, we will try to evaluate your issue.

Also, did you try exporting .jrprint to XLSX and how it goes?

Hi Amjas_Sahi,
I did try to exporting .jrprint to XLSX report and I am able to generate .XLSX file. But
I am using table component to print data in table format in excel report. I have added 298 columns in the JRXML table component. When I am using ACXLSExporter to export the excel report then ACXlsExporter is only allowing 255 columns to print when It is trying to print the column number 256 then it is throwing “Invalid column index” exception. I have already posted the exception in my previous post. So that I am not able to generate excel report with .XLSX extension when the column count is greater than 255.

So please help me if there is any solution !

@J1111111,

Could you provide .jrxml and data xml files and paste your sample Java code (runnable), we will check it soon.