supber

导航

excel表单导出

 private InputStream inputStream;
 private String fileName;

生成set  get     

注意get  return ====>   return  new String(fileName.getBytes(),"iso-8859-1");

//导出列表
 public String XLSExportAction() throws Exception{

//调用分页方法
  pageUtil = equipmentService.queryEquipmentList(new PmEquipmentVo(),pageNum);
  XLSExport e = new XLSExport("E:/test.xls");
  //设置表头
  e.addTableHead("选择","序号","设备名称","设备编号","生产商","价格(¥)","类型","启用时间","购买者","状态","编辑","删除");
  //添加表内信息
  e.addTableInfo(pageUtil.getList(), true);
  e.exportXLS();
  inputStream = new  FileInputStream("E:/test.xls");
  fileName = "设备列表.xls";//给表单命名
  return "export";
 }

posted on 2013-07-18 20:59  supber  阅读(273)  评论(0)    收藏  举报