From 0de3e57d6ba1ec883e026d48c9bea1f72c271c24 Mon Sep 17 00:00:00 2001
From: Jiaju Zhuang <zhuangjiaju@qq.com>
Date: Mon, 25 May 2020 16:14:19 +0800
Subject: [PATCH] =?UTF-8?q?*=20=E4=BF=AE=E5=A4=8D=E5=A4=8D=E6=9D=82?=
 =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E4=B8=8D=E6=98=AF`index=3D0`=E5=BC=80?=
 =?UTF-8?q?=E5=A7=8B=20=E5=90=88=E5=B9=B6=E5=BC=82=E5=B8=B8=E7=9A=84bug=20?=
 =?UTF-8?q?#1322?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../excel/write/property/ExcelWriteHeadProperty.java        | 6 ++++--
 update.md                                                   | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

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 68ca4107..979a7750 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 fd61d994..05d073a6 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