Browse Source

🔨 修复 getRelativeRowIndex 转换int 可能会导致的空指针异常

pull/3616/head
Marcho 1 year ago
parent
commit
91afb9206f
  1. 4
      easyexcel-core/src/main/java/com/alibaba/excel/write/style/row/AbstractRowHeightStyleStrategy.java
  2. 4
      easyexcel-core/src/main/java/com/alibaba/excel/write/style/row/SimpleRowHeightStyleStrategy.java

4
easyexcel-core/src/main/java/com/alibaba/excel/write/style/row/AbstractRowHeightStyleStrategy.java

@ -29,7 +29,7 @@ public abstract class AbstractRowHeightStyleStrategy implements RowWriteHandler
* @param row * @param row
* @param relativeRowIndex * @param relativeRowIndex
*/ */
protected abstract void setHeadColumnHeight(Row row, int relativeRowIndex); protected abstract void setHeadColumnHeight(Row row, Integer relativeRowIndex);
/** /**
* Sets the height of content * Sets the height of content
@ -37,6 +37,6 @@ public abstract class AbstractRowHeightStyleStrategy implements RowWriteHandler
* @param row * @param row
* @param relativeRowIndex * @param relativeRowIndex
*/ */
protected abstract void setContentColumnHeight(Row row, int relativeRowIndex); protected abstract void setContentColumnHeight(Row row, Integer relativeRowIndex);
} }

4
easyexcel-core/src/main/java/com/alibaba/excel/write/style/row/SimpleRowHeightStyleStrategy.java

@ -17,14 +17,14 @@ public class SimpleRowHeightStyleStrategy extends AbstractRowHeightStyleStrategy
} }
@Override @Override
protected void setHeadColumnHeight(Row row, int relativeRowIndex) { protected void setHeadColumnHeight(Row row, Integer relativeRowIndex) {
if (headRowHeight != null) { if (headRowHeight != null) {
row.setHeightInPoints(headRowHeight); row.setHeightInPoints(headRowHeight);
} }
} }
@Override @Override
protected void setContentColumnHeight(Row row, int relativeRowIndex) { protected void setContentColumnHeight(Row row, Integer relativeRowIndex) {
if (contentRowHeight != null) { if (contentRowHeight != null) {
row.setHeightInPoints(contentRowHeight); row.setHeightInPoints(contentRowHeight);
} }

Loading…
Cancel
Save