Merge pull request #138 from dataease/repr@dev_v1.0@c5df1c1ca1dacccdc95085a87efb21c2ff55e475@Identify_excel_columns

fix(excel): 识别 excel 列数
This commit is contained in:
taojinlong 2021-07-02 15:34:08 +08:00 committed by GitHub
commit 977c15bba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -890,7 +890,7 @@ public class DataSetTableService {
if (row == null) { if (row == null) {
throw new RuntimeException(Translator.get("i18n_excel_header_empty")); throw new RuntimeException(Translator.get("i18n_excel_header_empty"));
} }
columnNum = row.getPhysicalNumberOfCells(); columnNum = row.getLastCellNum();
} }
String[] r = new String[columnNum]; String[] r = new String[columnNum];
for (int j = 0; j < columnNum; j++) { for (int j = 0; j < columnNum; j++) {
@ -902,6 +902,7 @@ public class DataSetTableService {
if (StringUtils.isEmpty(columnName)) { if (StringUtils.isEmpty(columnName)) {
columnName = "NONE_" + String.valueOf(j); columnName = "NONE_" + String.valueOf(j);
} }
tableFiled.setFieldName(columnName); tableFiled.setFieldName(columnName);
tableFiled.setRemarks(columnName); tableFiled.setRemarks(columnName);
fields.add(tableFiled); fields.add(tableFiled);