From fee773f04b3180621530494fad8590babf2040e7 Mon Sep 17 00:00:00 2001 From: zjr2000 <71474767+zjr2000@users.noreply.github.com> Date: Sun, 9 May 2021 17:09:25 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#1651=EF=BC=9A=E4=BD=BF=E7=94=A8=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=A1=AB=E5=85=85=E5=AF=BC=E5=87=BA=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E8=AE=BE=E7=BD=AE=E8=87=AA=E5=8A=A8=E6=8D=A2=E8=A1=8C?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alibaba/excel/write/style/HorizontalCellStyleStrategy.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/alibaba/excel/write/style/HorizontalCellStyleStrategy.java b/src/main/java/com/alibaba/excel/write/style/HorizontalCellStyleStrategy.java index 295cd556..504570fa 100644 --- a/src/main/java/com/alibaba/excel/write/style/HorizontalCellStyleStrategy.java +++ b/src/main/java/com/alibaba/excel/write/style/HorizontalCellStyleStrategy.java @@ -60,9 +60,10 @@ public class HorizontalCellStyleStrategy extends AbstractCellStyleStrategy { @Override protected void setContentCellStyle(Cell cell, Head head, Integer relativeRowIndex) { - if (contentCellStyleList == null || contentCellStyleList.isEmpty()) { + if (contentCellStyleList == null || contentCellStyleList.isEmpty() || relativeRowIndex == null) { return; } + cell.setCellStyle(contentCellStyleList.get(relativeRowIndex % contentCellStyleList.size())); }