您的位置:首页 > 其它

dhcp服务配置文件/etc/dhcpd.conf详解

2012-12-11 23:40 363 查看
//poi导出excel 保存到本地

public void exportExcel(HttpServletRequest req, HttpServletResponse resp) throws IOException{

HSSFWorkbook wb = new HSSFWorkbook();
req.setCharacterEncoding("UTF-8");
resp.setCharacterEncoding("UTF-8");
resp.setContentType("application/x-download");

String filedisplay = "未匹配的产品清单.xls";
filedisplay = URLEncoder.encode(filedisplay, "UTF-8");
resp.addHeader("Content-Disposition", "attachment;filename="+ filedisplay);
HSSFSheet sheet = wb.createSheet("未匹配产品");
sheet.setColumnWidth(0, 50*160);
HSSFFont font = wb.createFont();
font.setFontName("宋体");
font.setFontHeightInPoints((short) 16);

HSSFRow row = sheet.createRow((int) 0);

HSSFCellStyle style = wb.createCellStyle();
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);

HSSFCell cell = row.createCell(0);
cell.setCellValue("产品名称");

Map<String, Object> params = new HashMap<String, Object>();
params.put("userId", this.getMember().getId());
params.put("matchabled", 0);
List<Match> matchs = this.getBeanManager().listBean(Match.class, params);

for (int i = 0; i < matchs.size(); i++) {
row = sheet.createRow((int) i + 1);
Match match = (Match) matchs.get(i);
row.createCell(0).setCellValue(match.getName());
}
try {
OutputStream out = resp.getOutputStream();
wb.write(out);
out.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: