ireport导出word问题求教

xu176032 2013-08-06 09:31:59

ireport导出word各种报错,不废话,直接上代码
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String dbUrl = "jdbc:oracle:thin:@11.131.45.243:1521:disdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection(dbUrl,"dma_dis","dma_dis");

ServletContext context=this.getServletContext();
String templatePath="/jaspertemplate/projecttemplate/";
HttpServletRequest request=ServletActionContext.getRequest();
String prjNo = request.getParameter("prjNo");
String path1="";


path1=context.getRealPath(templatePath+"project_examine_main.jasper");
String jrprintFile = new String(templatePath + "project_examine_main.jrprint");
System.out.println("path1=="+path1);

Map<String,Object> map1=new HashMap<String, Object>();
map1.put("prjNo", prjNo);

JasperPrint print1=JasperFillManager.fillReport(path1, map1,conn);
ArrayList<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
jasperPrintList.add(print1);


this.getResponse().setContentType("application/msword;charset=utf-8");
this.getResponse().setHeader("Content-disposition", "attachment; filename="+ "1.doc");
JRExporter exporter = new JRRtfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT,print1);
// exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST,jasperPrintList);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, this.getResponse().getOutputStream());
exporter.exportReport();

代码如上,在最后一行exporter.exportReport(); 一直报错,求大神指教一下,或者有其他的ireport导出word的代码发来参考一下,不胜感激

...全文
133 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xu176032 2013-08-08
  • 打赏
  • 举报
回复
就这么个问题,这么长时间连个回答的都没有, 问题自己解决了,结贴。
Edward_developer 2013-08-06
  • 打赏
  • 举报
回复
像CSDN这样的加载某个帖子的时候对应回复每个楼层的用户名和用户的头像 是不是根据存在帖子信息中的userID到用户信息表里查吗?哪样用户多的话 表大是一方面而且根据userID的话要每层楼都去查一遍啊。不知道怎么设计的。谁能指点迷津?

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧