java poi 导出问题 . 直接上代码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 HSSFWorkbook work = getHssFworkbook(list); int num =work.getSheetAt(0).getLastRowNum()-work.getSheetAt(0).getFirstRowNum(); System.out.println("总条数为"+num);// FileOutputStream fos = new FileOutputStream("c:/abc.xls");// work.write(fos);// fos.close(); Date enddate =new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); System.out.println("数据条数:"+list.size()); System.out.println("开始时间为:"+sdf.format(begindate)); System.out.println("结束时间为:"+sdf.format(enddate)); response.setCharacterEncoding("UTF-8"); String contenttype = "appliction/vnd.ms-excel"; response.setContentType(contenttype); response.setHeader("Content-Disposition", "attachment;filename=" + new String(("z" + ".xls").getBytes("gb2312"), "ISO8859-1")); work.write(response.getOutputStream());// response.flushBuffer(); 我看过本地的c:/abc.xls 是有数据的。 你下载 是 z.xls 这个文件从来哪里来的 这个只是一个导出的filename名字. 肯定是空白的 你的response是来自于 z.xls 你这个东西 都没有 下下来 肯定是白的 你前面那个打印总条数的数值是对的么,还有work.write(response.getOutputStream()); 这里在JSP页面老版本POI好像有BUG问题。 work.write(response.getOutputStream());不是这一句?那个filename应该只是名字吧。 反正用POI3.5之类从磁盘读取再打印出去respone是不行的。 求JS写弹出框思路或样例代码(有阻塞的那种) 替换规则怎么写? 散发了 就剩10分了!~~~ Ration Rose怎样生成代码 servlet有没有像jsp里面将属性与请教参数关联,自动执行类型转换的操作? 将jsp查询结果生成报表 eclipse的配置问题。关于JSP,XML,HTML等等的语法显亮。。 面试题,大家都来看看,能回答几题就回答几题! 请问如何将一个Action中的ArrayList传到JSP中?用struts 简单问题:如何将一个字符串分隔为一个数组?20分享送。在线。 java如何实现视屏监控 tomcat+hibernate配置jndi数据源的问题
HSSFWorkbook work = getHssFworkbook(list);
int num =work.getSheetAt(0).getLastRowNum()-work.getSheetAt(0).getFirstRowNum();
System.out.println("总条数为"+num);
// FileOutputStream fos = new FileOutputStream("c:/abc.xls");
// work.write(fos);
// fos.close();
Date enddate =new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
System.out.println("数据条数:"+list.size());
System.out.println("开始时间为:"+sdf.format(begindate));
System.out.println("结束时间为:"+sdf.format(enddate));
response.setCharacterEncoding("UTF-8");
String contenttype = "appliction/vnd.ms-excel";
response.setContentType(contenttype);
response.setHeader("Content-Disposition", "attachment;filename="
+ new String(("z" + ".xls").getBytes("gb2312"), "ISO8859-1"));
work.write(response.getOutputStream());
// response.flushBuffer();
还有work.write(response.getOutputStream()); 这里在JSP页面老版本POI好像有BUG问题。
不是这一句?
那个filename应该只是名字吧。