页面布局

java操作Excel的poi的导出Excel表格

点击导出用户:触发函数,直接访问后台

java操作Excel的poi的导出Excel表格

后台方法如下:

public String export()throws Exception{
		Connection con=null;
		try {
			con=dbUtil.getCon();
			Workbook wb=new HSSFWorkbook();  //创建工作簿

			String headers[]={"编号","姓名","电话","Email","QQ"};
			ResultSet rs=userDao.userList(con, null);
			ExcelUtil.fillExcelData(rs, wb, headers);
			ResponseUtil.export(ServletActionContext.getResponse(), wb, "导出excel.xls");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return null;
	}

  

源码:https://github.com/nideguigege/poi

相关文章:

  • 2022-12-23
  • 2021-09-12
  • 2022-02-08
  • 2021-09-01
  • 2021-05-26
  • 2022-02-15
  • 2021-11-09
  • 2021-09-15
猜你喜欢
  • 2022-01-05
  • 2021-09-24
  • 2021-06-14
  • 2021-11-19
  • 2022-12-23
  • 2021-10-13
相关资源
相似解决方案