diff --git a/core-parent/poi/src/main/java/icu/easyj/poi/excel/annotation/Excel.java b/core-parent/poi/src/main/java/icu/easyj/poi/excel/annotation/Excel.java index 59ce0443..86e84903 100644 --- a/core-parent/poi/src/main/java/icu/easyj/poi/excel/annotation/Excel.java +++ b/core-parent/poi/src/main/java/icu/easyj/poi/excel/annotation/Excel.java @@ -77,6 +77,8 @@ /** * 相同单元格合并定义 + * + * @since 0.7.8 */ String[] mergeSameCells() default {}; diff --git a/core-parent/poi/src/main/java/icu/easyj/poi/excel/model/ExcelMapping.java b/core-parent/poi/src/main/java/icu/easyj/poi/excel/model/ExcelMapping.java index 9a7955f0..60c22258 100644 --- a/core-parent/poi/src/main/java/icu/easyj/poi/excel/model/ExcelMapping.java +++ b/core-parent/poi/src/main/java/icu/easyj/poi/excel/model/ExcelMapping.java @@ -69,6 +69,8 @@ public class ExcelMapping implements Serializable { /** * 相同单元格合并 * 要注意多组合并的字段名不能相同 + * + * @since 0.7.8 */ private String[] mergeSameCells; @@ -214,10 +216,16 @@ public void setCellMappingList(List cellMappingList) { this.cellMappingList = cellMappingList; } + /** + * @since 0.7.8 + */ public String[] getMergeSameCells() { return mergeSameCells; } + /** + * @since 0.7.8 + */ public void setMergeSameCells(String[] mergeSameCells) { this.mergeSameCells = mergeSameCells; } @@ -247,6 +255,9 @@ public List getToExcelHookList() { //endregion + /** + * @since 0.7.8 + */ public ExcelCellMapping getCellMappingByFieldName(String fieldName) { for (ExcelCellMapping cellMapping : cellMappingList) { if (cellMapping.getColumn() != null && cellMapping.getColumn().equals(fieldName)) { diff --git a/core-parent/poi/src/main/java/icu/easyj/poi/excel/util/ExcelRowUtils.java b/core-parent/poi/src/main/java/icu/easyj/poi/excel/util/ExcelRowUtils.java index 96d7b29a..4673d0c0 100644 --- a/core-parent/poi/src/main/java/icu/easyj/poi/excel/util/ExcelRowUtils.java +++ b/core-parent/poi/src/main/java/icu/easyj/poi/excel/util/ExcelRowUtils.java @@ -323,6 +323,9 @@ public static void createDataRows(Sheet sheet, List dataList, ExcelMapping ma } } + /** + * @since 0.7.8 + */ public static void mergeSameCells(Sheet sheet, ExcelMapping mapping) { if (ArrayUtils.isEmpty(mapping.getMergeSameCells())) { return; // 未定义需要合并的单元格 diff --git a/core-parent/poi/src/main/java/icu/easyj/poi/excel/util/ExcelUtils.java b/core-parent/poi/src/main/java/icu/easyj/poi/excel/util/ExcelUtils.java index 27c545b1..34bb781b 100644 --- a/core-parent/poi/src/main/java/icu/easyj/poi/excel/util/ExcelUtils.java +++ b/core-parent/poi/src/main/java/icu/easyj/poi/excel/util/ExcelUtils.java @@ -257,7 +257,7 @@ private static Sheet generateSheet(Workbook book, List dataList, ExcelMapping if (CollectionUtils.isNotEmpty(dataList)) { // 创建数据行 ExcelRowUtils.createDataRows(sheet, dataList, mapping); - // 合并单元格 + // 合并单元格 @since 0.7.8 ExcelRowUtils.mergeSameCells(sheet, mapping); }