forked from github/dataease
feat(backend):excel解析优化
This commit is contained in:
parent
e2d6cd240c
commit
f3dadc8ffe
@ -723,6 +723,9 @@ public class DataSetTableService {
|
||||
for (int i = 0; i < rows; i++) {
|
||||
HSSFRow row = sheet0.getRow(i);
|
||||
if (i == 0) {
|
||||
if (row == null) {
|
||||
throw new RuntimeException(Translator.get("i18n_excel_header_empty"));
|
||||
}
|
||||
columnNum = row.getPhysicalNumberOfCells();
|
||||
}
|
||||
String[] r = new String[columnNum];
|
||||
@ -739,8 +742,14 @@ public class DataSetTableService {
|
||||
tableFiled.setRemarks(columnName);
|
||||
fields.add(tableFiled);
|
||||
} else if (i == 1) {
|
||||
if (row == null) {
|
||||
break;
|
||||
}
|
||||
r[j] = readCell(row.getCell(j), true, fields.get(j));
|
||||
} else {
|
||||
if (row == null) {
|
||||
break;
|
||||
}
|
||||
r[j] = readCell(row.getCell(j), false, null);
|
||||
}
|
||||
}
|
||||
@ -767,6 +776,9 @@ public class DataSetTableService {
|
||||
for (int i = 0; i < rows; i++) {
|
||||
XSSFRow row = sheet0.getRow(i);
|
||||
if (i == 0) {
|
||||
if (row == null) {
|
||||
throw new RuntimeException(Translator.get("i18n_excel_header_empty"));
|
||||
}
|
||||
columnNum = row.getPhysicalNumberOfCells();
|
||||
}
|
||||
String[] r = new String[columnNum];
|
||||
@ -783,8 +795,14 @@ public class DataSetTableService {
|
||||
tableFiled.setRemarks(columnName);
|
||||
fields.add(tableFiled);
|
||||
} else if (i == 1) {
|
||||
if (row == null) {
|
||||
break;
|
||||
}
|
||||
r[j] = readCell(row.getCell(j), true, fields.get(j));
|
||||
} else {
|
||||
if (row == null) {
|
||||
break;
|
||||
}
|
||||
r[j] = readCell(row.getCell(j), false, null);
|
||||
}
|
||||
}
|
||||
|
@ -252,4 +252,5 @@ i18n_id_or_pwd_error=Invalid ID or password
|
||||
i18n_datasource_delete=Data source is delete
|
||||
i18n_dataset_delete=Data set is delete
|
||||
i18n_chart_delete=Chart is delete
|
||||
i18n_not_exec_add_sync=There is no completed synchronization task. Incremental synchronization cannot be performed
|
||||
i18n_not_exec_add_sync=There is no completed synchronization task. Incremental synchronization cannot be performed
|
||||
i18n_excel_header_empty=Excel first row can not empty
|
@ -253,3 +253,4 @@ i18n_datasource_delete=当前用到的数据源已被删除
|
||||
i18n_dataset_delete=当前用到的数据集已被删除
|
||||
i18n_chart_delete=当前用到的视图已被删除
|
||||
i18n_not_exec_add_sync=没有已完成的同步任务,无法进行增量同步
|
||||
i18n_excel_header_empty=Excel第一行为空
|
||||
|
@ -254,4 +254,5 @@ i18n_id_or_pwd_error=無效的ID或密碼
|
||||
i18n_datasource_delete=當前用到的數據源已被刪除
|
||||
i18n_dataset_delete=當前用到的數據集已被刪除
|
||||
i18n_chart_delete=當前用到的視圖已被刪除
|
||||
i18n_not_exec_add_sync=沒有已經完成的同步任務,無法進行增量同步
|
||||
i18n_not_exec_add_sync=沒有已經完成的同步任務,無法進行增量同步
|
||||
i18n_excel_header_empty=Excel第一行為空
|
Loading…
Reference in New Issue
Block a user