fix: 校验 excel 第一行不能有空格

This commit is contained in:
taojinlong 2021-07-29 11:28:50 +08:00
parent 43c3e56905
commit 14b456f32a

View File

@ -250,13 +250,16 @@ public class ExcelXlsxReader extends DefaultHandler {
preRef = ref;
}
//补全单元格之间的空单元格
if (!ref.equals(preRef)) {
if (!"A".equals(preRef.substring(0, 1)) && curRow==1) {
throw new RuntimeException(Translator.get("i18n_excel_empty_column"));
}else if (!ref.equals(preRef)) {
int len = countNullCell(ref, preRef);
for (int i = 0; i < len; i++) {
cellList.add(curCol, "");
curCol++;
}
}
cellList.add(curCol, value);
curCol++;
//如果里面某个单元格含有值则标识该行不为空行