struts action实现jsp下载excel
来源:互联网 发布:租借法案 知乎 编辑:程序博客网 时间:2024/09/21 09:03
public String exportBiddingReport() throws Exception{
Map condition=new HashMap();
if(approveStartDate!=null&&approveStartDate.length()>7)
condition.put("approveStartDate", approveStartDate);
if(approveEndDate!=null&&approveEndDate.length()>7)
condition.put("approveEndDate", approveEndDate);
bidingList=reportService.getBidingReport(condition);
String fileName=this.getClass().getClassLoader().getResource("../../download/招投标信息表.xls").getPath();
InputStream inputStream=new FileInputStream(fileName);
HSSFWorkbook hwb=new HSSFWorkbook(inputStream);
HSSFSheet hs=hwb.getSheetAt(0);
for(int i=0;i<bidingList.size();i++){
HSSFRow hr=hs.createRow(i+1);
Map map=(Map)bidingList.get(i);
HSSFCell cell=hr.createCell((short)0);
cell.setCellValue(map.get("CODE").toString());
cell=hr.createCell((short)1);
if(map.get("APPROVE_DATE")!=null)
cell.setCellValue(map.get("APPROVE_DATE").toString());
cell=hr.createCell((short)2);
if(map.get("PROJEC_NAME")!=null)
cell.setCellValue(map.get("PROJEC_NAME").toString());
cell=hr.createCell((short)3);
if(map.get("BUDGET_VALUE")!=null)
cell.setCellValue(map.get("BUDGET_VALUE").toString());
cell=hr.createCell((short)4);
if(map.get("SIGN_DATE")!=null)
cell.setCellValue(map.get("SIGN_DATE").toString());
cell=hr.createCell((short)5);
if(map.get("CONSTRACT_VALUE")!=null)
cell.setCellValue(map.get("CONSTRACT_VALUE").toString());
cell=hr.createCell((short)6);
if(map.get("BUYTYPE")!=null)
cell.setCellValue(map.get("BUYTYPE").toString());
cell=hr.createCell((short)7);
if(map.get("VENDORNAME")!=null)
cell.setCellValue(map.get("VENDORNAME").toString());
cell=hr.createCell((short)8);
if(map.get("CONTACT")!=null)
cell.setCellValue(map.get("CONTACT").toString());
cell=hr.createCell((short)9);
if(map.get("CONTACTCHANNEL")!=null)
cell.setCellValue(map.get("CONTACTCHANNEL").toString());
cell=hr.createCell((short)10);
if(map.get("SUCCESS_DATE")!=null)
cell.setCellValue(map.get("SUCCESS_DATE").toString());
cell=hr.createCell((short)11);
if(map.get("SUCCESS_CAUSE")!=null)
cell.setCellValue(map.get("SUCCESS_CAUSE").toString());
cell=hr.createCell((short)12);
if(map.get("JUDGE_NUMBER")!=null)
cell.setCellValue(map.get("JUDGE_NUMBER").toString());
cell=hr.createCell((short)13);
if(map.get("MEETING_NUMBER")!=null)
cell.setCellValue(map.get("MEETING_NUMBER").toString());
cell=hr.createCell((short)14);
if(map.get("PROJECTTYPE")!=null)
cell.setCellValue(map.get("PROJECTTYPE").toString());
cell=hr.createCell((short)15);
if(map.get("SPEC")!=null)
cell.setCellValue(map.get("SPEC").toString());
cell=hr.createCell((short)16);
if(map.get("PRICE")!=null)
cell.setCellValue(map.get("PRICE").toString());
HSSFCellStyle style=hwb.createCellStyle();
style.setWrapText(true);
hs.setColumnWidth((short)17, (short)3766);
hs.setColumnWidth((short)18, (short)3766);
cell=hr.createCell((short)17);
cell.setCellStyle(style);
if(map.get("invite")!=null)
cell.setCellValue(map.get("invite").toString());
cell=hr.createCell((short)18);
cell.setCellStyle(style);
if(map.get("CONTRACT_MEMO")!=null)
cell.setCellValue(map.get("CONTRACT_MEMO").toString());
}
String downLoadName="招投标信息表.xls";
downLoadName=new String(downLoadName.getBytes(),"ISO8859-1");
response.setHeader("Content-disposition", "attachment;filename=".concat(downLoadName));
response.setContentType("application/x-download");
ServletOutputStream sos=response.getOutputStream();
hwb.write(sos);
return null;
}
- struts action实现jsp下载excel
- Struts的action实现导入excel表的代码
- struts 的action与jSP
- Struts 2 : 实现 Action
- 如何在Struts的Action中直接使用POI生成Excel并下载
- 使用Struts和POI实现Excel导出下载
- JSP页面下载EXCEL
- jsp提供excel下载
- jsp下载文件 excel
- jsp下载excel
- jsp下载Excel问题
- jsp里使用java excel api实现文件下载
- JSP从数据库导出数据到Excel下载的实现
- flash与jsp,struts action交互
- jsp和struts action的交互
- jsp和struts action的交互
- Struts jsp 遍历action中的数组
- struts中的JSP页面根据action跳转
- 关于js中取服务器端控件的值
- 用 javascript 获取当页面上鼠标(光标)位置 和 触发事件的对象 的方法
- java事件处理机制 自定义事件
- mysql 对utf8编码 中文排序
- 献给所有跑在求职路上的人-----转自BYR
- struts action实现jsp下载excel
- 【Visual C++】PeekMessage与GetMessage的对比
- C++工程设置为unicode环境
- Arcengine中设置坐标系
- WebView中JS的双向调用
- 【转!】一个游戏程序员的学习资料
- IOS成长之路-Nsstring中搜索方法rangeOfString
- 完善HTML中INPUT的对齐
- 一个简单的游戏服务器框架