From 4f88b23e82ec32e5af3bf1707319e9b6546fc590 Mon Sep 17 00:00:00 2001 From: liquanyu Date: Mon, 10 Oct 2016 13:12:18 +0800 Subject: [PATCH] code update --- .../com/lyms/platform/common/utils/ExcelUtil.java | 41 +++++++++++++++------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java b/platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java index 7114d0c..76b9339 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java +++ b/platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java @@ -41,13 +41,18 @@ public class ExcelUtil { wwb = Workbook.createWorkbook(out); WritableSheet ws = wwb.createSheet("sheet", 0); // 创建一个工作表 + // 设置指定行高 + ws.setRowView(0, 300); /** * 设置单元格样式 */ WritableFont wf = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); WritableCellFormat wcf = new WritableCellFormat(wf); - // 设置指定行高 - ws.setRowView(0, 300); + wcf.setAlignment(jxl.format.Alignment.CENTRE); + + WritableFont font1 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); + WritableCellFormat title1 = new WritableCellFormat(font1); + title1.setAlignment(jxl.format.Alignment.CENTRE); // 设置列宽 @@ -56,18 +61,30 @@ public class ExcelUtil ws.setColumnView(j, 15); } - ws.addCell(new Label(0, 0, "aaaa", wcf)); - ws.addCell(new Label(1, 0, "aaaa", wcf)); - ws.addCell(new Label(2, 0, "aaaa", wcf)); - ws.addCell(new Label(3, 0, "aaaa", wcf)); - ws.addCell(new Label(4, 0, "aaaa", wcf)); - ws.addCell(new Label(5, 0, "标题", wcf)); - ws.addCell(new Label(13, 0, "asdfasdf", wcf)); - ws.addCell(new Label(14, 0, "bbbb", wcf)); - - + ws.addCell(new Label(0, 0, "姓名", wcf)); + ws.addCell(new Label(1, 0, "当前年龄", wcf)); + ws.addCell(new Label(2, 0, "当前孕周", wcf)); + ws.addCell(new Label(3, 0, "联系方式", wcf)); + ws.addCell(new Label(4, 0, "处理意见", wcf)); + ws.addCell(new Label(5, 0, "姓名", wcf)); + ws.addCell(new Label(13, 0, "预约产检日期", wcf)); + ws.addCell(new Label(14, 0, "本院产检次数", wcf)); + ws.addCell(new Label(15, 0, "产检医生", wcf)); + ws.addCell(new Label(16, 0, "登记人", wcf)); + ws.addCell(new Label(17, 0, "服务类型", wcf)); + ws.addCell(new Label(18, 0, "高危因素", wcf)); + ws.addCell(new Label(19, 0, "高危等级", wcf)); + ws.addCell(new Label(20, 0, "预产期", wcf)); ws.mergeCells(5, 0, 12, 0); + ws.addCell(new Label(6, 1, "乙肝表面抗体", title1)); + ws.addCell(new Label(7, 1, "乙肝e抗原", title1)); + ws.addCell(new Label(8, 1, "乙肝e抗体", title1)); + ws.addCell(new Label(9, 1, "乙肝核心抗体", title1)); + ws.addCell(new Label(10, 1, "梅毒", title1)); + ws.addCell(new Label(11, 1, "HIV", title1)); + ws.addCell(new Label(12, 1, "丙肝", title1)); + // // 填充数据的内容 // Map map; // for (int i = 0, len = data.size(); i < len; i++) -- 1.8.3.1