WritableWorkbook book = Workbook.createWorkbook(response
.getOutputStream());
WritableSheet sheet = book.createSheet("交办卡片", 0);
try {
WritableFont rFont = new WritableFont(WritableFont.ARIAL, 14,
WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,
Colour.BLACK);
WritableCellFormat rCellFormat = new WritableCellFormat(rFont);
rCellFormat.setAlignment(Alignment.CENTRE);
rCellFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
rCellFormat.setBorder(Border.ALL, BorderLineStyle.THIN);
WritableFont conFont = new WritableFont(WritableFont.ARIAL, 12,
WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE,
Colour.BLACK);
WritableCellFormat conCellFormat = new WritableCellFormat(conFont);
conCellFormat.setAlignment(Alignment.CENTRE);
conCellFormat.setBorder(Border.ALL, BorderLineStyle.THIN);
Label wlabels = new Label(0, 0, "文号", conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(1, 0, "来文机关", conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(2, 0, "文件内容", conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(3, 0, "交办时间", conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(4, 0, "办结时间", conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(5, 0, "主办处室", conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(6, 0, "会办处室", conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(7, 0, "办理情况", conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(8, 0, "领导批示", conCellFormat);
sheet.addCell(wlabels);
for (int i = 0; i < typeV.size(); ++i) {
Map map = (HashMap) typeV.get(i);
wlabels = new Label(0, 1 + i, (String) map.get("BH"),
conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(1, 1 + i, (String) map.get("JBK_LWJG"),
conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(2, 1 + i, (String) map.get("TITLE"),
conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(3, 1 + i, (String) map.get("JBK_JBRQ"),
conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(4, 1 + i, (String) map.get("JBK_BJRQ"),
conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(5, 1 + i, (String) map.get(""),
conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(6, 1 + i, (String) map.get(""),
conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(7, 1 + i, "end".equals(((String) map.get("CURNODE")))?"已办结":"未办结", //判断是end的时候,为已办结。其余的为未办结
conCellFormat);
sheet.addCell(wlabels);
wlabels = new Label(8, 1 + i, (String) map.get("JBK_LDPS"),
conCellFormat);
sheet.addCell(wlabels);
}
book.write();
response.setContentType("aplication/msexcel");
String fileName = "交办卡片";
fileName = URLEncoder.encode(fileName, "utf-8");
response.setHeader("Content-disposition", "attachment; filename="
+ fileName + ".xls");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
book.close();
} catch (WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
相关推荐
jxl导出excel加水印 WritableWorkbook、WritableSheet、WritableCellFormat
jxl导出excel 完整例子工程jxl导出excel 完整例子工程jxl导出excel 完整例子工程 jxl导出excel 完整例子工程jxl导出excel 完整例子工程jxl导出excel 完整例子工程
jxl导出excel工具类,封装好了的,实现传递任意集合自动导出excel
使用jxl导出Excel表的好例子 导出excel表的例子
jxl导出Excel基础,非常有用的一个东西,漫漫看
jxl工具类导出excel,导出详细说明,及相关代码和jar,如有不明白私聊
本例为利用JXL导出Excel的代码示例
jxl导入导出excel 详细的描述了如何使用jxl导入导出excel。
java jxl导出excel文件前两天公司的同事用java jxl写了一段导出excel的代码,值得学习,现提供代码
自己做的jxl导出excel。
jxl从数据库中直接导出excel文档java源码
利用JXL技术支持模板和非模板的表格导出
Android使用jxl快速导出excel表
jxl导出excel数据的详细介绍和实例。。步骤详细,任何人都能看的明白。。。
这是一个jxl声称excel的示例,及jxl的文档
jxlapi和jar包 博文链接:https://dhl004.iteye.com/blog/1324644
jxl对excel添加水印(含有setWaterMarkImage方法).zip
封装了一个简单易用、通用、动态的从数据库导出到Excel的方法,可以动态的指定导出那些列,显示什么名字,按什么顺序显示;支持本地文件存储和JSP/Servlet文件下载。