提交 670f0326 authored 作者: taojinlong's avatar taojinlong

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

上级 5841b720
...@@ -254,13 +254,16 @@ public class ExcelXlsxReader extends DefaultHandler { ...@@ -254,13 +254,16 @@ public class ExcelXlsxReader extends DefaultHandler {
preRef = ref; 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); int len = countNullCell(ref, preRef);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
cellList.add(curCol, ""); cellList.add(curCol, "");
curCol++; curCol++;
} }
} }
cellList.add(curCol, value); cellList.add(curCol, value);
curCol++; curCol++;
//如果里面某个单元格含有值,则标识该行不为空行 //如果里面某个单元格含有值,则标识该行不为空行
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论