java - unable show chart in xls document using jasper reports -
i new jasper reports
. able export data through jasper reports excel sheet. when created pie chart in ireports
, showing on preview. when write below code in jsp
file view report in jasperviewer
, shows data along chart. when try save document (that in jasperviewer, gives many ways of saving report either in pdf or rtf or xls) xls error came in console
net.sf.jasperreports.engine.jrexception: cell cannot added.
however when remove chart .jrxml file, able export data excel file. read jr chart inserted image in excel document. xls document not taking images. below jsp file:
<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1" import="java.sql.*,java.util.*, net.sf.jasperreports.engine.*,java.io.*, net.sf.jasperreports.engine.design.*, net.sf.jasperreports.view.jasperviewer" %> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body> <% try{ class.forname("com.mysql.jdbc.driver"); connection con=drivermanager.getconnection("jdbc:mysql://localhost:3309/jasperdb", "root", "root"); fileinputstream fis=new fileinputstream(new file("c://documents , settings//james//report1.jrxml")); jasperreport jasperreport=jaspercompilemanager.compilereport(fis); jasperprint jasperprint=jasperfillmanager.fillreport(jasperreport,null,con); jasperviewer jv=new jasperviewer(jasperprint,false); jv.settitle("test"); jv.seticonimage(null); jv.setvisible(true); }catch(exception ex){ ex.printstacktrace(); } %> </body> </html>
when click on save button , choose xls report save following error comes in console:
net.sf.jasperreports.engine.jrexception: cell cannot added. @ net.sf.jasperreports.engine.export.jrxlsexporter.exportimage(jrxlsexporter.java:1683) @ net.sf.jasperreports.engine.export.jrxlsabstractexporter.exportpage(jrxlsabstractexporter.java:1047) @ net.sf.jasperreports.engine.export.jrxlsabstractexporter.exportreporttostream(jrxlsabstractexporter.java:831) @ net.sf.jasperreports.engine.export.jrxlsabstractexporter.exportreport(jrxlsabstractexporter.java:678) @ net.sf.jasperreports.view.save.jrsinglesheetxlssavecontributor.save(jrsinglesheetxlssavecontributor.java:123) @ net.sf.jasperreports.swing.jrviewertoolbar.btnsaveactionperformed(jrviewertoolbar.java:406) @ net.sf.jasperreports.swing.jrviewertoolbar$1.actionperformed(jrviewertoolbar.java:136) @ javax.swing.abstractbutton.fireactionperformed(unknown source) @ javax.swing.abstractbutton$handler.actionperformed(unknown source) @ javax.swing.defaultbuttonmodel.fireactionperformed(unknown source) @ javax.swing.defaultbuttonmodel.setpressed(unknown source) @ javax.swing.plaf.basic.basicbuttonlistener.mousereleased(unknown source) @ java.awt.awteventmulticaster.mousereleased(unknown source) @ java.awt.component.processmouseevent(unknown source) @ javax.swing.jcomponent.processmouseevent(unknown source) @ java.awt.component.processevent(unknown source) @ java.awt.container.processevent(unknown source) @ java.awt.component.dispatcheventimpl(unknown source) @ java.awt.container.dispatcheventimpl(unknown source) @ java.awt.component.dispatchevent(unknown source) @ java.awt.lightweightdispatcher.retargetmouseevent(unknown source) @ java.awt.lightweightdispatcher.processmouseevent(unknown source) @ java.awt.lightweightdispatcher.dispatchevent(unknown source) @ java.awt.container.dispatcheventimpl(unknown source) @ java.awt.window.dispatcheventimpl(unknown source) @ java.awt.component.dispatchevent(unknown source) @ java.awt.eventqueue.dispatcheventimpl(unknown source) @ java.awt.eventqueue.access$000(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(unknown source) @ java.security.protectiondomain$1.dointersectionprivilege(unknown source) @ java.awt.eventqueue$4.run(unknown source) @ java.awt.eventqueue$4.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(unknown source) @ java.awt.eventqueue.dispatchevent(unknown source) @ java.awt.eventdispatchthread.pumponeeventforfilters(unknown source) @ java.awt.eventdispatchthread.pumpeventsforfilter(unknown source) @ java.awt.eventdispatchthread.pumpeventsforhierarchy(unknown source) @ java.awt.eventdispatchthread.pumpevents(unknown source) @ java.awt.eventdispatchthread.pumpevents(unknown source) @ java.awt.eventdispatchthread.run(unknown source) caused by: java.lang.noclassdeffounderror: org/apache/commons/codec/digest/digestutils @ org.apache.poi.hssf.usermodel.hssfworkbook.addpicture(hssfworkbook.java:1610) @ net.sf.jasperreports.engine.export.jrxlsexporter.exportimage(jrxlsexporter.java:1667) ... 43 more caused by: java.lang.classnotfoundexception: org.apache.commons.codec.digest.digestutils @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1702) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1547) ... 45 more
this happening due chart image. guide me how can export chart image in xls document rest of data.
oh! such stupid. console error @ bottom screaming , telling class not found exception caused by: java.lang.classnotfoundexception: org.apache.commons.codec.digest.digestutils
resolve downloaded commons-codec-1.4.jar
file , placed in web-inf lib folder. working fine now.
Comments
Post a Comment