首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我正在尝试使用jasper report开发excel页面

问我正在尝试使用jasper report开发excel页面
EN

Stack Overflow用户
提问于 2012-12-12 17:12:25
回答 1查看 3.1K关注 0票数 6

我正在写Jasper报告。我试图生成excel文件,但我得到异常我的代码下面。

代码语言:javascript
复制
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(); 

例外是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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-12-12 17:25:43

您需要在CLASSPATH中包含Apache POI jar,excel导出需要Apache POI jar,您得到的消息是找不到POI类。

您可以从http://poi.apache.org/获取POI

另请参阅,以获得对您的问题的类似答案。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13836342

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档