magicrat Posted November 16, 2009 Share Posted November 16, 2009 Hi everyone.I'm using iReport 3.5.3. I need my report to be saved to xls but when I do that from the JasperViewer, I get the following exception: Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFCellStyle ... Caused by: java.lang.ClassNotFoundException: org.apache.poi.hssf.usermodel.HSSFCellStyle ...I haven't written any export code, I just diplay the JasperViewer with the report on the screen. The user then may want to print it or save it to XLS. The print works perfectly, but when I test the "save" from the viewer toolbar I get the above exception. And the same happens if I save to pdf (and to all formats I guess). However, when doing it from within iReports, it works prefectly well.I guess I need to include some JAR in the netbeans library path of my project (I only have jasperreports-3.5.3.jar), but I don't know which one.Here is the code I use to diplay the report: As you can see, it's pretty simple, as thi viewer suits my need perfectly well.Any help will be highly appreciated.Thanks in advance. Code:HashMap parameters = new HashMap();try { JRXmlDataSource jrxmlds = new JRXmlDataSource(m_xmlDoc, m_recordPath); parameters.put("SUBREPORT_DIR", m_strPath); JasperPrint print = JasperFillManager.fillReport( m_reportFileName, parameters, jrxmlds); JasperViewer jviewer = new JasperViewer(print, false); jviewer.setTitle(m_strTitle); jviewer.setVisible(true);} catch (JRException ex) { JOptionPane.showMessageDialog(null, "JRException!!!\nMessage:\n" + ex.getMessage(), "JRException", JOptionPane.WARNING_MESSAGE); if (logger.isLoggable(Level.SEVERE)) { logger.log(Level.SEVERE, null, ex); }} catch (Exception ex) { JOptionPane.showMessageDialog(null, "Exception!!!\nMessage:\n" + ex.getMessage(), "JRException", JOptionPane.WARNING_MESSAGE); if (logger.isLoggable(Level.SEVERE)) { logger.log(Level.SEVERE, null, ex); }} Link to comment Share on other sites More sharing options...
ctkrm Posted November 16, 2009 Share Posted November 16, 2009 Assuming you have the jasper reports project downloaded, copy the poi-3.2-FINAL-#######.jar to your classpath. That's the jar that contains the class you need. You may also need the jxl.jar on your app classpath as well. Link to comment Share on other sites More sharing options...
magicrat Posted November 17, 2009 Author Share Posted November 17, 2009 Thanks a lot!I've included both .jar you mentioned and the export works perfectly well.Thanks again. Link to comment Share on other sites More sharing options...
fico Posted March 20, 2012 Share Posted March 20, 2012 Thx including poi worked! :) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now