jasper export image in xls "cell cannot be added"

0

Hello everyone,

I've a problem with jasper to export my report in xls file. (JAVA SE, Eclipse, Windows 8).
I've got an image in my report with an absolute path, when I export into PDF file like that (code bellow) there is no problem 

JasperExportManager.exportReportToPdfFile(jasperPrint, outputFile.getPath());

but when I try to export into xls file with this code :

JRXlsExporter exporterXLS = new JRXlsExporter(); exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint);     exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_FILE, outputFile);     exporterXLS.exportReport();

I've got this error message "The cell cannot be added" (full source bellow) and my xls file is empty.

GRAVE: JRException
net.sf.jasperreports.engine.JRException: The cell cannot be added
at net.sf.jasperreports.engine.export.JRXlsExporter.exportImage(JRXlsExporter.java:1628)
at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportPage(JRXlsAbstractExporter.java:1000)
at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReportToStream(JRXlsAbstractExporter.java:795)
at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReport(JRXlsAbstractExporter.java:662)
at com.logetel.atlant.modules.editJasper.RootJasperController.generateTempFile(RootJasperController.java:164)
at com.logetel.atlant.modules.editJasper.RootJasperController.actionPerformed(RootJasperController.java:83)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at org.pushingpixels.substance.internal.utils.RolloverButtonListener.mouseReleased(RolloverButtonListener.java:124)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/codec/digest/DigestUtils
at org.apache.poi.hssf.usermodel.HSSFWorkbook.addPicture(HSSFWorkbook.java:1575)
at net.sf.jasperreports.engine.export.JRXlsExporter.exportImage(JRXlsExporter.java:1616)
... 43 more
When I delete this image my xls file is well generated..
I precise that my JasperPrint object is not null and all the parameters are well passed (I can generate the PDF, it means everything is OK (query,data,parameters,etc..) )
I'm using Substance Look And Feel, could this be because of that ?
How can I do to generate the xls file with the image, or at least be able to display my xls without the image file and make it visible only in the pdf file ?
thanks all !
PS : Sorry for my english, i'm french smiley
anthony.teixeira26's picture
Joined: Jun 16 2015 - 6:13am
Last seen: 3 years 8 months ago

nobody ? frown

anthony.teixeira26 - 4 years 5 months ago

well, I've succeeded to remove the image when I want to generate the report in xls file with this command :

jasperPrint.setProperty("net.sf.jasperreports.export.xls.ignore.graphics", "true");

If someone know anyway how to display the image in both jasper reports (pdf, xls) I'm still interested.

anthony.teixeira26 - 4 years 5 months ago

Hi, anthony. I used the same workaround with "simpleXlsReportConfiguration.setIgnoreGraphics(true);".
Did you have any progress with this issue? tks!

carlosabqf - 3 years 8 months ago
show 1 more...

be short of commons-codec.jar

904630498 - 3 years 6 months ago

1 Answer:

0

be short of commons-codec.jar

904630498's picture
Joined: Nov 12 2015 - 6:37pm
Last seen: 2 years 10 months ago
Feedback
randomness