Browse Source

fix #1651:使用模板填充导出的时候设置自动换行报错

pull/1923/head
zjr2000 4 years ago committed by GitHub
parent
commit
fee773f04b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/main/java/com/alibaba/excel/write/style/HorizontalCellStyleStrategy.java

3
src/main/java/com/alibaba/excel/write/style/HorizontalCellStyleStrategy.java

@ -60,9 +60,10 @@ public class HorizontalCellStyleStrategy extends AbstractCellStyleStrategy {
@Override @Override
protected void setContentCellStyle(Cell cell, Head head, Integer relativeRowIndex) { protected void setContentCellStyle(Cell cell, Head head, Integer relativeRowIndex) {
if (contentCellStyleList == null || contentCellStyleList.isEmpty()) { if (contentCellStyleList == null || contentCellStyleList.isEmpty() || relativeRowIndex == null) {
return; return;
} }
cell.setCellStyle(contentCellStyleList.get(relativeRowIndex % contentCellStyleList.size())); cell.setCellStyle(contentCellStyleList.get(relativeRowIndex % contentCellStyleList.size()));
} }

Loading…
Cancel
Save