WritableWorkbook wwb=null;
WritableSheet ws=null;
OutputStream os = response.getOutputStream();
wwb = Workbook.createWorkbook(os);
ws=wwb.createSheet("员工编号",0);
ws.getSettings().setDefaultColumnWidth(15);
ws.setColumnView(0,20);
ws.setColumnView(1,20);
ws.setColumnView(2,80);
Label label = new Label(0,0,"日期"); //
列 行 名称
ws.addCell(label);
label = new Label(1,0,"薪资");
ws.addCell(label);
label = new Label(2,0,"增幅");
ws.addCell(label);
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition","attachment; filename="+
new String((titlename).getBytes("gbk"),"iso8859-1")+".xls");
if(null!=pro_List && pro_List.size()>0){
Map oneMap = null ;
for(int i=0;i<pro_List.size();i++){
oneMap = pro_List.get(i) ;
label = new Label(0,(i+1),CommonString.getFormatPara(oneMap.get("date"))) ;
ws.addCell(label);
label = new Label(1,(i+1),CommonString.getFormatPara(oneMap.get("money"))) ;
ws.addCell(label);
label = new Label(2,(i+1),CommonString.getFormatPara(oneMap.get("amplification")).equals("")?"0":CommonString.getFormatPara(oneMap.get("amplification"))+"%") ;
ws.addCell(label);
}
}
wwb.write();
wwb.close();
os.close();
os = null ;
response.flushBuffer();
out.clear();
out = pageContext.pushBody();
分享到:
相关推荐
jsp导出Excel;简单实用!导出Excel;导出Word jsp导出Excel;简单实用!导出Excel;导出Word jsp导出Excel;简单实用!导出Excel;导出Word
jsp导出excel一般性问题及解决办法
jsp页面导出excel的实现相关代码,是从整个项目中把相关的几个页面拿出来分享一下
JSP导出excel和pdf格式JSP导出excel和pdf格式
jsp导入导出excel文件用的是poi和学习心得
java及jsp下导出excel表格,真心好用
最近实验室做了一个项目,使用jspsmartupload来实现的文件的上传下载,原来在windows平台运行的挺好,但是后来系统移植到linux平台上,结果在上传或下载的文件名中有中文时就会出现乱码。后来查了网上一些人的解决...
jspsmart上传组件,解决中文标题乱码,已修改源码为utf-8
jsp导出excel并支持分sheet导出的方法.docx
一种很简单的将JSP页面的table导出excel的方法
多文件上传例子,彻底解决中文乱码问题了。总结中文乱码问题如下: 1、所有页面都用UTF-8。 2、写过滤器,设置request.setCharacterEncoding("UTF-8")。 3、javascript脚本里用encodeURI(str)。 4、适当的时候,在...
jsp实现文件下载与中文文件名乱码问题解决
关于jsp导出excel用javascript实现
本人试过了可以用,做jsp程序导出excel功能的可以参考下,下载后按照模版进行修改
JSP导出Excel
查询数据跳转到当前的jsp,通过获取后台的接口数据导出excel文件,最后再自动跳转到上一个的页面。
JSP解决乱码JSP解决乱码JSP解决乱码JSP解决乱码JSP解决乱码
JSP中导入导出Excel文件.txt
最近在网上看到一个用java来操纵excel的open source,在weblogic上试用了一下,觉得很不错,特此向大家推荐一下。 首先去http://www.andykhan.com/jexcelapi/index.html下载最新的JExcelApi,把jxl.jar置于你的...
( response.setHeader()下载中文文件名乱码问题