2012-12-12 6 views
6

Sto lavorando alla relazione di Jasper. Provo a generare il file excel, ma sto ottenendo eccezione il mio codice qui sotto.Sto provando a sviluppare la pagina excel usando il rapporto Jasper

JasperReport jasperReport = JasperCompileManager.compileReport("C:\\jasper files\\report1.jrxml"); 
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JREmptyDataSource()); 

JRXlsExporter exporterXLS = new JRXlsExporter(); 
exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint); 
exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, "sample1.xls"); 
exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); 
exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); 
exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); 
exporterXLS.exportReport(); 

eccezione è Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Sheet at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more

risposta

4

È necessario includere il vaso Apache POI nel classpath, vaso Apache POI è necessario per Excel Export, il messaggio che si stanno ottenendo è che non può trovare la classe POI.

È possibile ottenere vaso POI dal http://poi.apache.org/

vedono anche here una risposta simile alla tua domanda.

+0

Grazie Nelson. Proverò ... – Naresh

+0

sono uscito. Grazie mille.. – Naresh

Problemi correlati