fix: 导入excel识别时间类型

This commit is contained in:
taojinlong 2021-10-15 13:29:17 +08:00
parent a27fe350ee
commit bb290704be
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,8 @@
package io.dataease.commons.utils;
import com.google.gson.Gson;
import io.dataease.datasource.dto.TableFiled;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;
@ -67,10 +69,10 @@ public class ExcelReaderUtil {
}
}
/* public static void main(String[] args) throws Exception {
public static void main(String[] args) throws Exception {
String file ="各省市GDP-表格_加内容.xlsx";
String file ="修改日期为mm-dd-yyyy.xlsx";
ExcelReaderUtil.readExcel(file, new FileInputStream("/Users/taojinlong/Desktop/" + file));
} */
}
}

View File

@ -319,6 +319,7 @@ public class ExcelXlsxReader extends DefaultHandler {
nextDataType = CellDataType.NUMBER; //cellType为空则表示该单元格类型为数字
formatIndex = -1;
formatString = null;
isDateFormat = false;
String cellType = attributes.getValue("t"); //单元格类型
if ("b".equals(cellType)) { //处理布尔值
nextDataType = CellDataType.BOOL;