diff --git a/src/main/java/com/alibaba/excel/analysis/v07/handlers/ProcessResultCellHandler.java b/src/main/java/com/alibaba/excel/analysis/v07/handlers/ProcessResultCellHandler.java index 419d43e3..95816463 100644 --- a/src/main/java/com/alibaba/excel/analysis/v07/handlers/ProcessResultCellHandler.java +++ b/src/main/java/com/alibaba/excel/analysis/v07/handlers/ProcessResultCellHandler.java @@ -10,6 +10,7 @@ import com.alibaba.excel.constant.ExcelXmlConstants; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.read.listener.event.EachRowAnalysisFinishEvent; import com.alibaba.excel.read.metadata.holder.ReadRowHolder; +import com.alibaba.excel.util.PositionUtils; /** * Cell Handler @@ -32,8 +33,8 @@ public class ProcessResultCellHandler implements XlsxCellHandler { @Override public void startHandle(String name, Attributes attributes) { - analysisContext - .readRowHolder(new ReadRowHolder(Integer.valueOf(attributes.getValue(ExcelXmlConstants.POSITION)), + analysisContext.readRowHolder( + new ReadRowHolder(PositionUtils.getRowByRowTagt(attributes.getValue(ExcelXmlConstants.POSITION)), analysisContext.readSheetHolder().getGlobalConfiguration())); } diff --git a/src/main/java/com/alibaba/excel/util/PositionUtils.java b/src/main/java/com/alibaba/excel/util/PositionUtils.java index 090bbdfa..f135e473 100644 --- a/src/main/java/com/alibaba/excel/util/PositionUtils.java +++ b/src/main/java/com/alibaba/excel/util/PositionUtils.java @@ -7,6 +7,14 @@ public class PositionUtils { private PositionUtils() {} + public static int getRowByRowTagt(String rowTagt) { + int row = 0; + if (rowTagt != null) { + row = Integer.parseInt(rowTagt) - 1; + } + return row; + } + public static int getRow(String currentCellIndex) { int row = 0; if (currentCellIndex != null) {