diff --git a/src/main/java/com/alibaba/excel/write/property/ExcelWriteHeadProperty.java b/src/main/java/com/alibaba/excel/write/property/ExcelWriteHeadProperty.java index 68ca410..979a775 100644 --- a/src/main/java/com/alibaba/excel/write/property/ExcelWriteHeadProperty.java +++ b/src/main/java/com/alibaba/excel/write/property/ExcelWriteHeadProperty.java @@ -66,7 +66,8 @@ public class ExcelWriteHeadProperty extends ExcelHeadProperty { Integer index = entry.getKey(); ExcelContentProperty excelContentPropertyData = entry.getValue(); if (excelContentPropertyData == null) { - throw new IllegalArgumentException("Passing in the class and list the head, the two must be the same size."); + throw new IllegalArgumentException( + "Passing in the class and list the head, the two must be the same size."); } Field field = excelContentPropertyData.getField(); Head headData = getHeadMap().get(index); @@ -180,7 +181,8 @@ public class ExcelWriteHeadProperty extends ExcelHeadProperty { if (j == lastRow && i == lastCol) { continue; } - cellRangeList.add(new CellRange(j, lastRow, i, lastCol)); + cellRangeList + .add(new CellRange(j, lastRow, head.getColumnIndex(), headList.get(lastCol).getColumnIndex())); } } return cellRangeList; diff --git a/update.md b/update.md index fd61d99..05d073a 100644 --- a/update.md +++ b/update.md @@ -6,6 +6,7 @@ * 修复多个`sheet`不按照顺序写入 会乱序的bug [Issue #1332](https://github.com/alibaba/easyexcel/issues/1332) * 修改head是List时,内容单元格的样式不生效 [Issue #1339](https://github.com/alibaba/easyexcel/issues/1339) * 新增写入`class`和`list`同时传入 `field`数量不一致报错 [Issue #1333](https://github.com/alibaba/easyexcel/issues/1333) +* 修复复杂表头不是`index=0`开始 合并异常的bug [Issue #1322](https://github.com/alibaba/easyexcel/issues/1322) # 2.2.3