제3자poi 도구를 이용하여 주해 방식으로 내보내기

2360 단어 excel
-- - pojo 엔티티 클래스public class UserChangeVo extends BaseVO implements Cloneable {
/** @Fields serialVersionUID: */
private static final long serialVersionUID = 1L;

@Excel(name = " ", width = 35)
private String userSum;//  

@Excel(name = " ", width = 35)
private String addSum;//  

@Excel(name = " ", width = 35)
private String btSum;//  

@Excel(name = " ", width = 35)
private String zcSum;//  

@Excel(name = " ", width = 35)
private String xhSum;//  

}//get set 메서드 필요
--- 내보내기
    /**
     * 
     * @Description
     * @return
     * @throws Exception
     */
    @RequestMapping("/exportUserInfo.do")
    public void exportUserInfo(HttpServletResponse response,UserChangeVo userChangeVo) throws Exception {
Listvo=userChangeService.getCustomSum(userChangeVo);// 
ExportParams exportParams = new ExportParams();
exportParams.setSheetName(" ");// 
exportParams.setTitle(" ");// 
Workbook workbook=ExcelExportUtil.exportExcel(exportParams,
UserChangeVo.class, vo);// 
response.setContentType("applicationnd.ms-excel"); //  excel 
String fileName = java.net.URLEncoder.encode(" ", "UTF-8");
response.setHeader("Content-disposition", "attachment; filename="+ fileName + ".xls");// 03 xls, xlsx
OutputStream out = response.getOutputStream();
        workbook.write(out);// 
}

좋은 웹페이지 즐겨찾기