修复配置导入Excel文件存在空行时,错误信息行号与文件行号对不上bug

This commit is contained in:
zhangwenqing
2019-03-25 10:00:31 +08:00
parent 253adc1396
commit a1ad694260
2 changed files with 24 additions and 6 deletions

View File

@@ -112,7 +112,8 @@ public abstract class XLSXCovertCSVReader {
// private String[] record;
// private List<String[]> rows = new ArrayList<String[]>();
private boolean isCellNull = false;
private int upRowId; // 记录上一行行号
/**
* Accepts objects needed while parsing.
*
@@ -203,8 +204,23 @@ public abstract class XLSXCovertCSVReader {
if (this.formatString == null)
this.formatString = BuiltinFormats
.getBuiltinFormat(this.formatIndex);
}
}
}
}else if("row".equals(name)) {
// 获取行号
String r = attributes.getValue("r");
int index = Integer.parseInt(r);
int gap = index - upRowId;
if(gap > 1) { // 存在空行
while(gap > 1) {
optRows(sheetIndex,lastColumnNumber,rowlist);
gap--;
}
}
upRowId = index;
}
lastContents = "";
}