我试图用碧玉报告来开发Excel页面
我正在做贾斯珀报告。 我尝试生成Excel文件,但我得到例外我的代码如下。
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();
exception是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
您需要在您的CLASSPATH中包含Apache POI jar,为了导出excel需要Apache POI jar,您得到的消息是找不到POI类。
您可以从http://poi.apache.org/获取POI jar
在这里也可以看到类似的回答你的问题。
- 在itextSharp中使用LocationTextExtractionStrategy作为文本坐标
- Excel VBA中的高效低版本套件
- 在创build新工作簿时,将select单元格粘贴到列中
- 如何添加每个第三行的值(如:a1,a4,a7,a10等)超过240个条目?
- Excel VBA:WorkSheet_FollowHyperlink不被称为形状对象(msoPicture)
- 使用Apache POI读取Excel,XML MAP元素名称
- 如果行的一个单元格以某个string开头,则VBA Excel删除行
- 仅使用值导出工作表(而不是公式)
- Excel 2010用VBAreplaceWEBSERVICE()