From fe142ab57dae32f508bc8991797c4ec0c8862b37 Mon Sep 17 00:00:00 2001 From: jueyue Date: Fri, 9 Jan 2015 21:06:15 +0800 Subject: [PATCH] =?UTF-8?q?Excel=20=E5=AF=BC=E5=87=BA=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E7=9A=84=E8=AE=BE=E7=BD=AE,=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../poi/excel/ExcelExportUtil.java | 3 +- .../poi/excel/entity/ExportParams.java | 15 +- .../excel/entity/TemplateExportParams.java | 27 +++- .../excel/entity/enmus/ExcelStyleType.java | 34 +++++ .../poi/excel/entity/enmus/ExcelType.java | 2 +- .../poi/excel/export/ExcelExportServer.java | 134 ++++-------------- .../excel/export/base/ExcelExportBase.java | 56 +++++--- .../styler/AbstractExcelExportStyler.java | 54 +++++++ .../styler/ExcelExportStylerBorderImpl.java | 68 +++++++++ .../styler/ExcelExportStylerColorImpl.java | 76 ++++++++++ .../styler/ExcelExportStylerDefaultImpl.java | 63 ++++++++ .../export/styler/IExcelExportStyler.java | 52 +++++++ .../template/ExcelExportOfTemplateUtil.java | 8 +- .../imports/verifys/VerifyHandlerServer.java | 1 + .../poi/handler/inter/IExcelDataHandler.java | 4 + .../poi/excel/MyExcelExport.java | 41 ------ .../template/TemplateExcelExportTest.java | 6 +- .../excel/test/ExcelExportStatisticTest.java | 4 +- .../excel/test/ExcelExportTemplateTest.java | 2 + pom.xml | 11 -- 20 files changed, 470 insertions(+), 191 deletions(-) create mode 100644 easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/enmus/ExcelStyleType.java create mode 100644 easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/AbstractExcelExportStyler.java create mode 100644 easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/ExcelExportStylerBorderImpl.java create mode 100644 easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/ExcelExportStylerColorImpl.java create mode 100644 easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/ExcelExportStylerDefaultImpl.java create mode 100644 easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/IExcelExportStyler.java delete mode 100644 easypoi-test/src/main/java/org/jeecgframework/poi/excel/MyExcelExport.java diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/ExcelExportUtil.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/ExcelExportUtil.java index 036d7a0..8ee0da9 100644 --- a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/ExcelExportUtil.java +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/ExcelExportUtil.java @@ -12,7 +12,6 @@ import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.TemplateExportParams; import org.jeecgframework.poi.excel.entity.enmus.ExcelType; import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity; -import org.jeecgframework.poi.excel.entity.vo.PoiBaseConstants; import org.jeecgframework.poi.excel.export.ExcelExportServer; import org.jeecgframework.poi.excel.export.template.ExcelExportOfTemplateUtil; @@ -85,8 +84,8 @@ public final class ExcelExportUtil { } else { workbook = new XSSFWorkbook(); } - ExcelExportServer server = new ExcelExportServer(); for (Map map : list) { + ExcelExportServer server = new ExcelExportServer(); server.createSheet(workbook, (ExportParams) map.get("title"), (Class) map.get("entity"), (Collection) map.get("data")); } diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/ExportParams.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/ExportParams.java index 5479f75..79d6b23 100644 --- a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/ExportParams.java +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/ExportParams.java @@ -2,6 +2,7 @@ package org.jeecgframework.poi.excel.entity; import org.apache.poi.hssf.util.HSSFColor; import org.jeecgframework.poi.excel.entity.enmus.ExcelType; +import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerDefaultImpl; /** * Excel 导出参数 @@ -19,7 +20,7 @@ public class ExportParams extends ExcelBaseParams { /** * 表格名称 */ - private short titleHeight = 20; + private short titleHeight = 10; /** * 第二行名称 @@ -58,6 +59,10 @@ public class ExportParams extends ExcelBaseParams { * Excel 导出版本 */ private ExcelType type = ExcelType.HSSF; + /** + * Excel 导出style + */ + private Class style = ExcelExportStylerDefaultImpl.class; public ExportParams() { @@ -168,4 +173,12 @@ public class ExportParams extends ExcelBaseParams { this.indexName = indexName; } + public Class getStyle() { + return style; + } + + public void setStyle(Class style) { + this.style = style; + } + } diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/TemplateExportParams.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/TemplateExportParams.java index 1fd2b6d..77d615b 100644 --- a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/TemplateExportParams.java +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/TemplateExportParams.java @@ -1,5 +1,7 @@ package org.jeecgframework.poi.excel.entity; +import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerDefaultImpl; + /** * 模板导出参数设置 * @@ -12,27 +14,31 @@ public class TemplateExportParams extends ExcelBaseParams { /** * 模板的路径 */ - private String templateUrl; + private String templateUrl; /** * 需要导出的第几个 sheetNum,默认是第0个 */ - private int sheetNum = 0; + private int sheetNum = 0; /** * 这只sheetName 不填就使用原来的 */ - private String sheetName; + private String sheetName; /** * 表格列标题行数,默认1 */ - private int headingRows = 1; + private int headingRows = 1; /** * 表格列标题开始行,默认1 */ - private int headingStartRow = 1; + private int headingStartRow = 1; + /** + * Excel 导出style + */ + private Class style = ExcelExportStylerDefaultImpl.class; public TemplateExportParams() { @@ -41,14 +47,17 @@ public class TemplateExportParams extends ExcelBaseParams { public TemplateExportParams(String templateUrl) { this.templateUrl = templateUrl; } + public TemplateExportParams(String templateUrl, int sheetNum) { this.templateUrl = templateUrl; this.sheetNum = sheetNum; } + public TemplateExportParams(String templateUrl, String sheetName) { this.templateUrl = templateUrl; this.sheetName = sheetName; } + public TemplateExportParams(String templateUrl, String sheetName, int sheetNum) { this.templateUrl = templateUrl; this.sheetName = sheetName; @@ -95,4 +104,12 @@ public class TemplateExportParams extends ExcelBaseParams { this.templateUrl = templateUrl; } + public Class getStyle() { + return style; + } + + public void setStyle(Class style) { + this.style = style; + } + } diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/enmus/ExcelStyleType.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/enmus/ExcelStyleType.java new file mode 100644 index 0000000..4878d7c --- /dev/null +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/enmus/ExcelStyleType.java @@ -0,0 +1,34 @@ +package org.jeecgframework.poi.excel.entity.enmus; + +import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerBorderImpl; +import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerColorImpl; +import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerDefaultImpl; + +/** + * 插件提供的几个默认样式 + * @author JueYue + * @date 2015年1月9日 下午9:02:24 + */ +public enum ExcelStyleType { + + NONE("默认样式", ExcelExportStylerDefaultImpl.class), + BORDER("边框样式", ExcelExportStylerBorderImpl.class), + COLOR("间隔行样式", ExcelExportStylerColorImpl.class); + + private String name; + private Class clazz; + + ExcelStyleType(String name, Class clazz) { + this.name = name; + this.clazz = clazz; + } + + public Class getClazz() { + return clazz; + } + + public String getName() { + return name; + } + +} diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/enmus/ExcelType.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/enmus/ExcelType.java index d25b9b9..4d6ac65 100644 --- a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/enmus/ExcelType.java +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/enmus/ExcelType.java @@ -8,5 +8,5 @@ package org.jeecgframework.poi.excel.entity.enmus; public enum ExcelType { HSSF, XSSF; - + } diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/ExcelExportServer.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/ExcelExportServer.java index 78669aa..0222d2b 100644 --- a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/ExcelExportServer.java +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/ExcelExportServer.java @@ -4,15 +4,12 @@ import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.poi.ss.usermodel.BuiltinFormats; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Drawing; -import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; @@ -23,6 +20,8 @@ import org.jeecgframework.poi.excel.entity.enmus.ExcelType; import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity; import org.jeecgframework.poi.excel.entity.vo.PoiBaseConstants; import org.jeecgframework.poi.excel.export.base.ExcelExportBase; +import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerDefaultImpl; +import org.jeecgframework.poi.excel.export.styler.IExcelExportStyler; import org.jeecgframework.poi.exception.excel.ExcelExportException; import org.jeecgframework.poi.exception.excel.enums.ExcelExportEnum; import org.jeecgframework.poi.util.POIPublicUtil; @@ -37,12 +36,10 @@ import org.slf4j.LoggerFactory; */ public class ExcelExportServer extends ExcelExportBase { - private final static Logger logger = LoggerFactory.getLogger(ExcelExportServer.class); - - private static final short cellFormat = (short) BuiltinFormats.getBuiltinFormat("TEXT"); + private final static Logger logger = LoggerFactory.getLogger(ExcelExportServer.class); // 最大行数,超过自动多Sheet - private int MAX_NUM = 60000; + private int MAX_NUM = 60000; private int createHeaderAndTitle(ExportParams entity, Sheet sheet, Workbook workbook, List excelParams) { @@ -66,7 +63,12 @@ public class ExcelExportServer extends ExcelExportBase { public int createHeaderRow(ExportParams entity, Sheet sheet, Workbook workbook, int feildWidth) { Row row = sheet.createRow(0); row.setHeight(entity.getTitleHeight()); - createStringCell(row, 0, entity.getTitle(), getHeaderStyle(workbook, entity), null); + createStringCell(row, 0, entity.getTitle(), + getExcelExportStyler().getHeaderStyle(entity.getHeaderColor()), null); + for (int i = 1; i <= feildWidth; i++) { + createStringCell(row, i, "", + getExcelExportStyler().getHeaderStyle(entity.getHeaderColor()), null); + } sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, feildWidth)); if (entity.getSecondTitle() != null) { row = sheet.createRow(1); @@ -74,6 +76,10 @@ public class ExcelExportServer extends ExcelExportBase { CellStyle style = workbook.createCellStyle(); style.setAlignment(CellStyle.ALIGN_RIGHT); createStringCell(row, 0, entity.getSecondTitle(), style, null); + for (int i = 1; i <= feildWidth; i++) { + createStringCell(row, i, "", + getExcelExportStyler().getHeaderStyle(entity.getHeaderColor()), null); + } sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, feildWidth)); return 2; } @@ -106,8 +112,9 @@ public class ExcelExportServer extends ExcelExportBase { if (dataHanlder != null) { needHanlderList = Arrays.asList(dataHanlder.getNeedHandlerFields()); } - // 创建表格属性 - Map styles = createStyles(workbook); + // 创建表格样式 + setExcelExportStyler((IExcelExportStyler) entity.getStyle() + .getConstructor(Workbook.class).newInstance(workbook)); Drawing patriarch = sheet.createDrawingPatriarch(); List excelParams = new ArrayList(); if (entity.isAddIndex()) { @@ -128,8 +135,7 @@ public class ExcelExportServer extends ExcelExportBase { List tempList = new ArrayList(); while (its.hasNext()) { Object t = its.next(); - index += createCells(patriarch, index, t, excelParams, sheet, workbook, styles, - rowHeight); + index += createCells(patriarch, index, t, excelParams, sheet, workbook, rowHeight); tempList.add(t); if (index >= MAX_NUM) break; @@ -142,7 +148,7 @@ public class ExcelExportServer extends ExcelExportBase { its.remove(); } // 创建合计信息 - addStatisticsRow(styles.get("one"), sheet); + addStatisticsRow(getExcelExportStyler().getStyles(true, true), sheet); // 发现还有剩余list 继续循环创建Sheet if (dataSet.size() > 0) { @@ -151,7 +157,7 @@ public class ExcelExportServer extends ExcelExportBase { } catch (Exception e) { e.printStackTrace(); - logger.error(e.getMessage(),e); + logger.error(e.getMessage(), e); throw new ExcelExportException(ExcelExportEnum.EXPORT_ERROR, e.getCause()); } } @@ -182,8 +188,9 @@ public class ExcelExportServer extends ExcelExportBase { if (dataHanlder != null) { needHanlderList = Arrays.asList(dataHanlder.getNeedHandlerFields()); } - // 创建表格属性 - Map styles = createStyles(workbook); + // 创建表格样式 + setExcelExportStyler((IExcelExportStyler) entity.getStyle() + .getConstructor(Workbook.class).newInstance(workbook)); Drawing patriarch = sheet.createDrawingPatriarch(); List excelParams = new ArrayList(); if (entity.isAddIndex()) { @@ -200,8 +207,7 @@ public class ExcelExportServer extends ExcelExportBase { List tempList = new ArrayList(); while (its.hasNext()) { Object t = its.next(); - index += createCells(patriarch, index, t, excelParams, sheet, workbook, styles, - rowHeight); + index += createCells(patriarch, index, t, excelParams, sheet, workbook, rowHeight); tempList.add(t); if (index >= MAX_NUM) break; @@ -219,20 +225,11 @@ public class ExcelExportServer extends ExcelExportBase { } } catch (Exception e) { - logger.error(e.getMessage(),e); + logger.error(e.getMessage(), e); throw new ExcelExportException(ExcelExportEnum.EXPORT_ERROR, e.getCause()); } } - private Map createStyles(Workbook workbook) { - Map map = new HashMap(); - map.put("one", getOneStyle(workbook, false)); - map.put("oneWrap", getOneStyle(workbook, true)); - map.put("two", getTwoStyle(workbook, false)); - map.put("twoWrap", getTwoStyle(workbook, true)); - return map; - } - /** * 创建表头 * @@ -250,7 +247,7 @@ public class ExcelExportServer extends ExcelExportBase { listRow.setHeight((short) 450); } int cellIndex = 0; - CellStyle titleStyle = getTitleStyle(workbook, title); + CellStyle titleStyle = getExcelExportStyler().getTitleStyle(title.getColor()); for (int i = 0, exportFieldTitleSize = excelParams.size(); i < exportFieldTitleSize; i++) { ExcelExportEntity entity = excelParams.get(i); createStringCell(row, cellIndex, entity.getName(), titleStyle, entity); @@ -265,6 +262,7 @@ public class ExcelExportServer extends ExcelExportBase { cellIndex++; } } else if (rows == 2) { + createStringCell(listRow, cellIndex, "", titleStyle, entity); sheet.addMergedRegion(new CellRangeAddress(index, index + 1, cellIndex, cellIndex)); } cellIndex++; @@ -273,38 +271,6 @@ public class ExcelExportServer extends ExcelExportBase { } - /** - * 表明的Style - * - * @param workbook - * @return - */ - public CellStyle getHeaderStyle(Workbook workbook, ExportParams entity) { - CellStyle titleStyle = workbook.createCellStyle(); - Font font = workbook.createFont(); - font.setFontHeightInPoints((short) 24); - titleStyle.setFont(font); - titleStyle.setFillForegroundColor(entity.getColor()); - titleStyle.setAlignment(CellStyle.ALIGN_CENTER); - titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - return titleStyle; - } - - public CellStyle getOneStyle(Workbook workbook, boolean isWarp) { - CellStyle style = workbook.createCellStyle(); - style.setBorderLeft((short) 1); // 左边框 - style.setBorderRight((short) 1); // 右边框 - style.setBorderBottom((short) 1); - style.setBorderTop((short) 1); - style.setAlignment(CellStyle.ALIGN_CENTER); - style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - style.setDataFormat(cellFormat); - if (isWarp) { - style.setWrapText(true); - } - return style; - } - /** * 判断表头是只有一行还是两行 * @@ -320,52 +286,6 @@ public class ExcelExportServer extends ExcelExportBase { return 1; } - public CellStyle getStyles(Map map, boolean needOne, boolean isWrap) { - if (needOne && isWrap) { - return map.get("oneWrap"); - } - if (needOne) { - return map.get("one"); - } - if (needOne == false && isWrap) { - return map.get("twoWrap"); - } - return map.get("two"); - } - - /** - * 字段说明的Style - * - * @param workbook - * @return - */ - public CellStyle getTitleStyle(Workbook workbook, ExportParams entity) { - CellStyle titleStyle = workbook.createCellStyle(); - titleStyle.setFillForegroundColor(entity.getHeaderColor()); // 填充的背景颜色 - titleStyle.setAlignment(CellStyle.ALIGN_CENTER); - titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - titleStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); // 填充图案 - titleStyle.setWrapText(true); - return titleStyle; - } - - public CellStyle getTwoStyle(Workbook workbook, boolean isWarp) { - CellStyle style = workbook.createCellStyle(); - style.setBorderLeft((short) 1); // 左边框 - style.setBorderRight((short) 1); // 右边框 - style.setBorderBottom((short) 1); - style.setBorderTop((short) 1); - style.setFillForegroundColor((short) 41); // 填充的背景颜色 - style.setFillPattern(CellStyle.SOLID_FOREGROUND); // 填充图案 - style.setAlignment(CellStyle.ALIGN_CENTER); - style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - style.setDataFormat(cellFormat); - if (isWarp) { - style.setWrapText(true); - } - return style; - } - private ExcelExportEntity indexExcelEntity(ExportParams entity) { ExcelExportEntity exportEntity = new ExcelExportEntity(); exportEntity.setOrderNum(0); diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/base/ExcelExportBase.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/base/ExcelExportBase.java index 99b7039..322a5d4 100644 --- a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/base/ExcelExportBase.java +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/base/ExcelExportBase.java @@ -32,10 +32,11 @@ import org.jeecgframework.poi.excel.entity.enmus.ExcelType; import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity; import org.jeecgframework.poi.excel.entity.params.MergeEntity; import org.jeecgframework.poi.excel.entity.vo.PoiBaseConstants; +import org.jeecgframework.poi.excel.export.styler.IExcelExportStyler; import org.jeecgframework.poi.util.POIPublicUtil; /** - * 导出基础服务 + * 提供POI基础操作服务 * * @author JueYue * @date 2014年6月17日 下午6:15:13 @@ -50,6 +51,8 @@ public abstract class ExcelExportBase extends ExportBase { private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00"); + private IExcelExportStyler excelExportStyler; + private boolean checkIsEqualByCellContents(MergeEntity mergeEntity, String text, Cell cell, int[] delys, int rowNum) { // 没有依赖关系 @@ -78,12 +81,12 @@ public abstract class ExcelExportBase extends ExportBase { */ public int createCells(Drawing patriarch, int index, Object t, List excelParams, Sheet sheet, Workbook workbook, - Map styles, short rowHeight) throws Exception { + short rowHeight) throws Exception { ExcelExportEntity entity; Row row = sheet.createRow(index); row.setHeight(rowHeight); int maxHeight = 1, cellNum = 0; - int indexKey = createIndexCell(row, styles, index, excelParams.get(0)); + int indexKey = createIndexCell(row, index, excelParams.get(0)); cellNum += indexKey; for (int k = indexKey, paramSize = excelParams.size(); k < paramSize; k++) { entity = excelParams.get(k); @@ -92,7 +95,7 @@ public abstract class ExcelExportBase extends ExportBase { int listC = 0; for (Object obj : list) { createListCells(patriarch, index + listC, cellNum, obj, entity.getList(), - sheet, workbook, styles); + sheet, workbook); listC++; } cellNum += entity.getList().size(); @@ -106,8 +109,8 @@ public abstract class ExcelExportBase extends ExportBase { row, cellNum++, value == null ? "" : value.toString(), - index % 2 == 0 ? getStyles(styles, false, entity.isWrap()) : getStyles( - styles, true, entity.isWrap()), entity); + index % 2 == 0 ? getStyles(false, entity.isWrap()) : getStyles(true, + entity.isWrap()), entity); } else { createImageCell(patriarch, entity, row, cellNum++, value == null ? "" : value.toString(), t); @@ -124,7 +127,7 @@ public abstract class ExcelExportBase extends ExportBase { for (int i = index + 1; i < index + maxHeight; i++) { sheet.getRow(i).createCell(cellNum); sheet.getRow(i).getCell(cellNum) - .setCellStyle(getStyles(styles, false, entity.isWrap())); + .setCellStyle(getStyles(false, entity.isWrap())); } sheet.addMergedRegion(new CellRangeAddress(index, index + maxHeight - 1, cellNum, cellNum)); @@ -190,13 +193,11 @@ public abstract class ExcelExportBase extends ExportBase { } - private int createIndexCell(Row row, Map styles, int index, - ExcelExportEntity excelExportEntity) { + private int createIndexCell(Row row, int index, ExcelExportEntity excelExportEntity) { if (excelExportEntity.getName().equals("序号") && excelExportEntity.getFormat().equals(PoiBaseConstants.IS_ADD_INDEX)) { - createStringCell(row, 0, currentIndex + "", - index % 2 == 0 ? getStyles(styles, false, false) : getStyles(styles, true, false), - null); + createStringCell(row, 0, currentIndex + "", index % 2 == 0 ? getStyles(false, false) + : getStyles(true, false), null); currentIndex = currentIndex + 1; return 1; } @@ -209,8 +210,8 @@ public abstract class ExcelExportBase extends ExportBase { * @param styles */ public void createListCells(Drawing patriarch, int index, int cellNum, Object obj, - List excelParams, Sheet sheet, - Workbook workbook, Map styles) throws Exception { + List excelParams, Sheet sheet, Workbook workbook) + throws Exception { ExcelExportEntity entity; Row row; if (sheet.getRow(index) == null) { @@ -223,9 +224,12 @@ public abstract class ExcelExportBase extends ExportBase { entity = excelParams.get(k); Object value = getCellValue(entity, obj); if (entity.getType() == 1) { - createStringCell(row, cellNum++, value == null ? "" : value.toString(), - row.getRowNum() % 2 == 0 ? getStyles(styles, false, entity.isWrap()) - : getStyles(styles, true, entity.isWrap()), entity); + createStringCell( + row, + cellNum++, + value == null ? "" : value.toString(), + row.getRowNum() % 2 == 0 ? getStyles(false, entity.isWrap()) : getStyles(true, + entity.isWrap()), entity); } else { createImageCell(patriarch, entity, row, cellNum++, value == null ? "" : value.toString(), obj); @@ -376,8 +380,14 @@ public abstract class ExcelExportBase extends ExportBase { return mergeMap; } - public CellStyle getStyles(Map styles, boolean needOne, boolean wrap) { - return null; + /** + * 获取样式 + * @param needOne + * @param isWrap + * @return + */ + public CellStyle getStyles(boolean needOne, boolean isWrap) { + return excelExportStyler.getStyles(needOne, isWrap); } /** @@ -485,4 +495,12 @@ public abstract class ExcelExportBase extends ExportBase { this.currentIndex = currentIndex; } + public void setExcelExportStyler(IExcelExportStyler excelExportStyler) { + this.excelExportStyler = excelExportStyler; + } + + public IExcelExportStyler getExcelExportStyler() { + return excelExportStyler; + } + } diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/AbstractExcelExportStyler.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/AbstractExcelExportStyler.java new file mode 100644 index 0000000..3f1984d --- /dev/null +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/AbstractExcelExportStyler.java @@ -0,0 +1,54 @@ +package org.jeecgframework.poi.excel.export.styler; + +import org.apache.poi.ss.usermodel.BuiltinFormats; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Workbook; + +/** + * 抽象接口提供两个公共方法 + * @author JueYue + * @date 2015年1月9日 下午5:48:55 + */ +public abstract class AbstractExcelExportStyler implements IExcelExportStyler { + + protected CellStyle oneStyle; + protected CellStyle oneWrapStyle; + protected CellStyle doubleStyle; + protected CellStyle doubleWrapStyle; + protected Workbook workbook; + + protected static final short cellFormat = (short) BuiltinFormats.getBuiltinFormat("TEXT"); + + protected void createStyles(Workbook workbook) { + this.oneStyle = createOneStyle(workbook, false); + this.oneWrapStyle = createOneStyle(workbook, true); + this.doubleStyle = createDoubleStyle(workbook, false); + this.doubleWrapStyle = createDoubleStyle(workbook, true); + this.workbook = workbook; + } + + @Override + public CellStyle getStyles(boolean needOne, boolean isWrap) { + if (needOne && isWrap) { + return oneWrapStyle; + } + if (needOne) { + return oneStyle; + } + if (needOne == false && isWrap) { + return doubleWrapStyle; + } + return doubleStyle; + } + + @Override + public CellStyle createOneStyle(Workbook workbook, boolean isWarp) { + return null; + } + + @Override + public CellStyle createDoubleStyle(Workbook workbook, boolean isWarp) { + return null; + } + +} diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/ExcelExportStylerBorderImpl.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/ExcelExportStylerBorderImpl.java new file mode 100644 index 0000000..6d64fff --- /dev/null +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/ExcelExportStylerBorderImpl.java @@ -0,0 +1,68 @@ +package org.jeecgframework.poi.excel.export.styler; + +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.ss.usermodel.Workbook; + +/** + * 带有边框的Excel样式 + * @author JueYue + * @date 2015年1月9日 下午5:55:29 + */ +public class ExcelExportStylerBorderImpl extends AbstractExcelExportStyler implements + IExcelExportStyler { + + public ExcelExportStylerBorderImpl(Workbook workbook) { + super.createStyles(workbook); + } + + @Override + public CellStyle getHeaderStyle(short color) { + CellStyle titleStyle = workbook.createCellStyle(); + Font font = workbook.createFont(); + font.setFontHeightInPoints((short) 12); + titleStyle.setFont(font); + titleStyle.setBorderLeft((short) 1); // 左边框 + titleStyle.setBorderRight((short) 1); // 右边框 + titleStyle.setBorderBottom((short) 1); + titleStyle.setBorderTop((short) 1); + titleStyle.setAlignment(CellStyle.ALIGN_CENTER); + titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + return titleStyle; + } + + @Override + public CellStyle createOneStyle(Workbook workbook, boolean isWarp) { + CellStyle style = workbook.createCellStyle(); + style.setBorderLeft((short) 1); // 左边框 + style.setBorderRight((short) 1); // 右边框 + style.setBorderBottom((short) 1); + style.setBorderTop((short) 1); + style.setAlignment(CellStyle.ALIGN_CENTER); + style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + style.setDataFormat(cellFormat); + if (isWarp) { + style.setWrapText(true); + } + return style; + } + + @Override + public CellStyle getTitleStyle(short color) { + CellStyle titleStyle = workbook.createCellStyle(); + titleStyle.setBorderLeft((short) 1); // 左边框 + titleStyle.setBorderRight((short) 1); // 右边框 + titleStyle.setBorderBottom((short) 1); + titleStyle.setBorderTop((short) 1); + titleStyle.setAlignment(CellStyle.ALIGN_CENTER); + titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + titleStyle.setWrapText(true); + return titleStyle; + } + + @Override + public CellStyle createDoubleStyle(Workbook workbook, boolean isWarp) { + return isWarp ? oneWrapStyle : oneStyle; + } + +} diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/ExcelExportStylerColorImpl.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/ExcelExportStylerColorImpl.java new file mode 100644 index 0000000..af72fc3 --- /dev/null +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/ExcelExportStylerColorImpl.java @@ -0,0 +1,76 @@ +package org.jeecgframework.poi.excel.export.styler; + +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.ss.usermodel.Workbook; + +/** + * 带有样式的导出服务 + * @author JueYue + * @date 2015年1月9日 下午4:54:15 + */ +public class ExcelExportStylerColorImpl extends AbstractExcelExportStyler implements + IExcelExportStyler { + + public ExcelExportStylerColorImpl(Workbook workbook) { + super.createStyles(workbook); + } + + @Override + public CellStyle getHeaderStyle(short headerColor) { + CellStyle titleStyle = workbook.createCellStyle(); + Font font = workbook.createFont(); + font.setFontHeightInPoints((short) 24); + titleStyle.setFont(font); + titleStyle.setFillForegroundColor(headerColor); + titleStyle.setAlignment(CellStyle.ALIGN_CENTER); + titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + return titleStyle; + } + + @Override + public CellStyle createOneStyle(Workbook workbook, boolean isWarp) { + CellStyle style = workbook.createCellStyle(); + style.setBorderLeft((short) 1); // 左边框 + style.setBorderRight((short) 1); // 右边框 + style.setBorderBottom((short) 1); + style.setBorderTop((short) 1); + style.setAlignment(CellStyle.ALIGN_CENTER); + style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + style.setDataFormat(cellFormat); + if (isWarp) { + style.setWrapText(true); + } + return style; + } + + @Override + public CellStyle getTitleStyle(short color) { + CellStyle titleStyle = workbook.createCellStyle(); + titleStyle.setFillForegroundColor(color); // 填充的背景颜色 + titleStyle.setAlignment(CellStyle.ALIGN_CENTER); + titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + titleStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); // 填充图案 + titleStyle.setWrapText(true); + return titleStyle; + } + + @Override + public CellStyle createDoubleStyle(Workbook workbook, boolean isWarp) { + CellStyle style = workbook.createCellStyle(); + style.setBorderLeft((short) 1); // 左边框 + style.setBorderRight((short) 1); // 右边框 + style.setBorderBottom((short) 1); + style.setBorderTop((short) 1); + style.setFillForegroundColor((short) 41); // 填充的背景颜色 + style.setFillPattern(CellStyle.SOLID_FOREGROUND); // 填充图案 + style.setAlignment(CellStyle.ALIGN_CENTER); + style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + style.setDataFormat(cellFormat); + if (isWarp) { + style.setWrapText(true); + } + return style; + } + +} diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/ExcelExportStylerDefaultImpl.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/ExcelExportStylerDefaultImpl.java new file mode 100644 index 0000000..ef55a54 --- /dev/null +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/ExcelExportStylerDefaultImpl.java @@ -0,0 +1,63 @@ +package org.jeecgframework.poi.excel.export.styler; + +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.ss.usermodel.Workbook; + +/** + * 样式的默认实现 + * @author JueYue + * @date 2015年1月9日 下午5:36:08 + */ +public class ExcelExportStylerDefaultImpl extends AbstractExcelExportStyler implements + IExcelExportStyler { + + public ExcelExportStylerDefaultImpl(Workbook workbook) { + super.createStyles(workbook); + } + + @Override + public CellStyle getTitleStyle(short color) { + CellStyle titleStyle = workbook.createCellStyle(); + titleStyle.setAlignment(CellStyle.ALIGN_CENTER); + titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + titleStyle.setWrapText(true); + return titleStyle; + } + + @Override + public CellStyle createDoubleStyle(Workbook workbook, boolean isWarp) { + CellStyle style = workbook.createCellStyle(); + style.setAlignment(CellStyle.ALIGN_CENTER); + style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + style.setDataFormat(cellFormat); + if (isWarp) { + style.setWrapText(true); + } + return style; + } + + @Override + public CellStyle getHeaderStyle(short color) { + CellStyle titleStyle = workbook.createCellStyle(); + Font font = workbook.createFont(); + font.setFontHeightInPoints((short) 12); + titleStyle.setFont(font); + titleStyle.setAlignment(CellStyle.ALIGN_CENTER); + titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + return titleStyle; + } + + @Override + public CellStyle createOneStyle(Workbook workbook, boolean isWarp) { + CellStyle style = workbook.createCellStyle(); + style.setAlignment(CellStyle.ALIGN_CENTER); + style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + style.setDataFormat(cellFormat); + if (isWarp) { + style.setWrapText(true); + } + return style; + } + +} diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/IExcelExportStyler.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/IExcelExportStyler.java new file mode 100644 index 0000000..fb9f645 --- /dev/null +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/styler/IExcelExportStyler.java @@ -0,0 +1,52 @@ +package org.jeecgframework.poi.excel.export.styler; + +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Workbook; + +/** + * Excel导出样式接口 + * @author JueYue + * @date 2015年1月9日 下午5:32:30 + */ +public interface IExcelExportStyler { + + /** + * 列表头样式 + * @param headerColor + * @return + */ + public CellStyle getHeaderStyle(short headerColor); + + /** + * 标题样式 + * @param color + * @return + */ + public CellStyle getTitleStyle(short color); + + /** + * 获取样式方法 + * @param map + * @param needOne + * @param isWrap + * @return + */ + public CellStyle getStyles(boolean needOne, boolean isWrap); + + /** + * 创建样式 + * @param workbook + * @param isWarp + * @return + */ + public CellStyle createOneStyle(Workbook workbook, boolean isWarp); + + /** + * 创建双行样式 + * @param workbook + * @param isWarp + * @return + */ + public CellStyle createDoubleStyle(Workbook workbook, boolean isWarp); + +} diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/template/ExcelExportOfTemplateUtil.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/template/ExcelExportOfTemplateUtil.java index 0441fbd..2e0d90a 100644 --- a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/template/ExcelExportOfTemplateUtil.java +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/export/template/ExcelExportOfTemplateUtil.java @@ -22,6 +22,7 @@ import org.jeecgframework.poi.excel.entity.TemplateExportParams; import org.jeecgframework.poi.excel.entity.enmus.ExcelType; import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity; import org.jeecgframework.poi.excel.export.base.ExcelExportBase; +import org.jeecgframework.poi.excel.export.styler.IExcelExportStyler; import org.jeecgframework.poi.exception.excel.ExcelExportException; import org.jeecgframework.poi.exception.excel.enums.ExcelExportEnum; import org.jeecgframework.poi.util.POIPublicUtil; @@ -64,6 +65,9 @@ public final class ExcelExportOfTemplateUtil extends ExcelExportBase { if (etarget != null) { targetId = etarget.value(); } + // 创建表格样式 + setExcelExportStyler((IExcelExportStyler) params.getStyle().getConstructor(Workbook.class) + .newInstance(workbook)); // 获取实体对象的导出数据 List excelParams = new ArrayList(); getAllExcelField(null, targetId, fileds, excelParams, pojoClass, null); @@ -78,7 +82,7 @@ public final class ExcelExportOfTemplateUtil extends ExcelExportBase { Iterator its = dataSet.iterator(); while (its.hasNext()) { Object t = its.next(); - index += createCells(patriarch, index, t, excelParams, sheet, workbook, null, rowHeight); + index += createCells(patriarch, index, t, excelParams, sheet, workbook, rowHeight); } // 合并同类项 mergeCells(sheet, excelParams, titleHeight); @@ -148,7 +152,7 @@ public final class ExcelExportOfTemplateUtil extends ExcelExportBase { addDataToSheet(params, pojoClass, dataSet, wb.getSheetAt(0), wb); } } catch (Exception e) { - LOGGER.error(e.getMessage(),e); + LOGGER.error(e.getMessage(), e); return null; } return wb; diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/imports/verifys/VerifyHandlerServer.java b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/imports/verifys/VerifyHandlerServer.java index 73d1b84..e37ec18 100644 --- a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/imports/verifys/VerifyHandlerServer.java +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/excel/imports/verifys/VerifyHandlerServer.java @@ -12,6 +12,7 @@ import org.jeecgframework.poi.handler.inter.IExcelVerifyHandler; * @date 2014年6月29日 下午4:37:56 */ public class VerifyHandlerServer { + private void addVerifyResult(ExcelVerifyHanlderResult temp, ExcelVerifyHanlderResult result) { if (!temp.isSuccess()) { result.setSuccess(false); diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/handler/inter/IExcelDataHandler.java b/easypoi-base/src/main/java/org/jeecgframework/poi/handler/inter/IExcelDataHandler.java index 5f60a75..7a04f11 100644 --- a/easypoi-base/src/main/java/org/jeecgframework/poi/handler/inter/IExcelDataHandler.java +++ b/easypoi-base/src/main/java/org/jeecgframework/poi/handler/inter/IExcelDataHandler.java @@ -41,6 +41,10 @@ public interface IExcelDataHandler { */ public Object importHandler(Object obj, String name, Object value); + /** + * 设置需要处理的属性列表 + * @param fields + */ public void setNeedHandlerFields(String[] fields); } diff --git a/easypoi-test/src/main/java/org/jeecgframework/poi/excel/MyExcelExport.java b/easypoi-test/src/main/java/org/jeecgframework/poi/excel/MyExcelExport.java deleted file mode 100644 index c7e2572..0000000 --- a/easypoi-test/src/main/java/org/jeecgframework/poi/excel/MyExcelExport.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jeecgframework.poi.excel; - -import java.util.Map; - -import org.apache.poi.ss.usermodel.CellStyle; -import org.apache.poi.ss.usermodel.Workbook; -import org.jeecgframework.poi.excel.entity.ExportParams; -import org.jeecgframework.poi.excel.export.ExcelExportServer; -/** - * 自己定义导出的样式 - * @author JueYue - * @date 2014年12月2日 上午10:32:44 - */ -public class MyExcelExport extends ExcelExportServer { - - @Override - public CellStyle getHeaderStyle(Workbook workbook, ExportParams entity) { - return super.getHeaderStyle(workbook, entity); - } - - @Override - public CellStyle getOneStyle(Workbook workbook, boolean isWarp) { - return super.getOneStyle(workbook, isWarp); - } - - @Override - public CellStyle getStyles(Map map, boolean needOne, boolean isWrap) { - return super.getStyles(map, needOne, isWrap); - } - - @Override - public CellStyle getTitleStyle(Workbook workbook, ExportParams entity) { - return super.getTitleStyle(workbook, entity); - } - - @Override - public CellStyle getTwoStyle(Workbook workbook, boolean isWarp) { - return super.getTwoStyle(workbook, isWarp); - } - -} diff --git a/easypoi-test/src/main/java/org/jeecgframework/poi/excel/template/TemplateExcelExportTest.java b/easypoi-test/src/main/java/org/jeecgframework/poi/excel/template/TemplateExcelExportTest.java index 13a436a..1fc6ebd 100644 --- a/easypoi-test/src/main/java/org/jeecgframework/poi/excel/template/TemplateExcelExportTest.java +++ b/easypoi-test/src/main/java/org/jeecgframework/poi/excel/template/TemplateExcelExportTest.java @@ -17,6 +17,9 @@ import org.jeecgframework.poi.entity.temp.PayeeEntity; import org.jeecgframework.poi.entity.temp.TemplateExcelExportEntity; import org.jeecgframework.poi.excel.ExcelExportUtil; import org.jeecgframework.poi.excel.entity.TemplateExportParams; +import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerBorderImpl; +import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerColorImpl; +import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerDefaultImpl; import org.junit.Test; import com.google.common.collect.Lists; @@ -29,6 +32,7 @@ public class TemplateExcelExportTest { "org/jeecgframework/poi/excel/doc/专项支出用款申请书.xls"); params.setHeadingStartRow(3); params.setHeadingRows(2); + params.setStyle(ExcelExportStylerColorImpl.class); Map map = new HashMap(); map.put("date", "2014-12-25"); map.put("money", 2000000.00); @@ -40,7 +44,7 @@ public class TemplateExcelExportTest { List list = new ArrayList(); - for (int i = 0; i < 1; i++) { + for (int i = 0; i < 4; i++) { TemplateExcelExportEntity entity = new TemplateExcelExportEntity(); entity.setIndex(i + 1 + ""); entity.setAccountType("开源项目"); diff --git a/easypoi-test/src/main/java/org/jeecgframework/poi/excel/test/ExcelExportStatisticTest.java b/easypoi-test/src/main/java/org/jeecgframework/poi/excel/test/ExcelExportStatisticTest.java index c611d5b..9f5d876 100644 --- a/easypoi-test/src/main/java/org/jeecgframework/poi/excel/test/ExcelExportStatisticTest.java +++ b/easypoi-test/src/main/java/org/jeecgframework/poi/excel/test/ExcelExportStatisticTest.java @@ -11,6 +11,7 @@ import org.apache.poi.ss.usermodel.Workbook; import org.jeecgframework.poi.entity.statistics.StatisticEntity; import org.jeecgframework.poi.excel.ExcelExportUtil; import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.enmus.ExcelStyleType; import org.jeecgframework.poi.excel.entity.enmus.ExcelType; import org.jeecgframework.poi.excel.entity.vo.PoiBaseConstants; import org.junit.Test; @@ -20,7 +21,7 @@ public class ExcelExportStatisticTest { public void test() throws Exception { List list = new ArrayList(); - for (int i = 0; i < 25000; i++) { + for (int i = 0; i < 20; i++) { StatisticEntity client = new StatisticEntity(); client.setName("index" + i); client.setIntTest(1 + i); @@ -32,6 +33,7 @@ public class ExcelExportStatisticTest { } Date start = new Date(); ExportParams params = new ExportParams("2412312", "测试", ExcelType.XSSF); + params.setStyle(ExcelStyleType.COLOR.getClazz()); Workbook workbook = ExcelExportUtil.exportExcel(params, StatisticEntity.class, list); System.out.println(new Date().getTime() - start.getTime()); File savefile = new File("d:/"); diff --git a/easypoi-test/src/main/java/org/jeecgframework/poi/excel/test/ExcelExportTemplateTest.java b/easypoi-test/src/main/java/org/jeecgframework/poi/excel/test/ExcelExportTemplateTest.java index 4c7f731..87eca1b 100644 --- a/easypoi-test/src/main/java/org/jeecgframework/poi/excel/test/ExcelExportTemplateTest.java +++ b/easypoi-test/src/main/java/org/jeecgframework/poi/excel/test/ExcelExportTemplateTest.java @@ -14,6 +14,7 @@ import org.jeecgframework.poi.entity.StudentEntity; import org.jeecgframework.poi.entity.TeacherEntity; import org.jeecgframework.poi.excel.ExcelExportUtil; import org.jeecgframework.poi.excel.entity.TemplateExportParams; +import org.jeecgframework.poi.excel.entity.enmus.ExcelStyleType; import org.junit.Before; import org.junit.Test; @@ -27,6 +28,7 @@ public class ExcelExportTemplateTest { TemplateExportParams params = new TemplateExportParams(); params.setHeadingRows(2); params.setHeadingStartRow(2); + params.setStyle(ExcelStyleType.BORDER.getClazz()); Map map = new HashMap(); map.put("year", "2013"); map.put("sunCourses", list.size()); diff --git a/pom.xml b/pom.xml index 646b674..f1c336f 100644 --- a/pom.xml +++ b/pom.xml @@ -155,15 +155,4 @@ - - - postaop-common-release - http://192.168.1.99:8081/nexus/content/repositories/postaop-common-release/ - - - postaop-common-snapshot - http://192.168.1.99:8081/nexus/content/repositories/postaop-common-snapshot/ - - - \ No newline at end of file