提交 bb290704 authored 作者: taojinlong's avatar taojinlong

fix: 导入excel识别时间类型

上级 a27fe350
package io.dataease.commons.utils; package io.dataease.commons.utils;
import com.google.gson.Gson; import com.google.gson.Gson;
import io.dataease.datasource.dto.TableFiled; import io.dataease.datasource.dto.TableFiled;
import java.io.FileInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
...@@ -67,10 +69,10 @@ public class ExcelReaderUtil { ...@@ -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)); ExcelReaderUtil.readExcel(file, new FileInputStream("/Users/taojinlong/Desktop/" + file));
} */ }
} }
...@@ -319,6 +319,7 @@ public class ExcelXlsxReader extends DefaultHandler { ...@@ -319,6 +319,7 @@ public class ExcelXlsxReader extends DefaultHandler {
nextDataType = CellDataType.NUMBER; //cellType为空,则表示该单元格类型为数字 nextDataType = CellDataType.NUMBER; //cellType为空,则表示该单元格类型为数字
formatIndex = -1; formatIndex = -1;
formatString = null; formatString = null;
isDateFormat = false;
String cellType = attributes.getValue("t"); //单元格类型 String cellType = attributes.getValue("t"); //单元格类型
if ("b".equals(cellType)) { //处理布尔值 if ("b".equals(cellType)) { //处理布尔值
nextDataType = CellDataType.BOOL; nextDataType = CellDataType.BOOL;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论