Looly 5 years ago
parent
commit
c9a7340bbd

+ 4 - 1
CHANGELOG.md

@@ -3,12 +3,15 @@
 
 -------------------------------------------------------------------------------------------------------------
 
-# 5.4.1 (2020-08-19)
+# 5.4.1 (2020-08-20)
 
 ### 新特性
 * 【core  】     StrUtil增加firstNonXXX方法(issue#1020@Github)
 * 【core  】     BeanCopier修改规则,可选bean拷贝空字段报错问题(pr#160@Gitee)
+
 ### Bug修复#
+* 【poi   】     修复ExcelBase.isXlsx方法判断问题(issue#I1S502@Gitee)
+* 【poi   】     修复Excel03SaxReader日期方法判断问题(pr#1026@Github)
 
 -------------------------------------------------------------------------------------------------------------
 

+ 2 - 1
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java

@@ -10,6 +10,7 @@ import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.streaming.SXSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 
 import java.io.Closeable;
@@ -415,7 +416,7 @@ public class ExcelBase<T extends ExcelBase<T>> implements Closeable {
 	 * @since 4.6.2
 	 */
 	public boolean isXlsx() {
-		return this.sheet instanceof XSSFSheet;
+		return this.sheet instanceof XSSFSheet || this.sheet instanceof SXSSFSheet;
 	}
 
 	/**

+ 2 - 2
hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel03SaxReader.java

@@ -294,10 +294,10 @@ public class Excel03SaxReader extends AbstractExcelSaxReader<Excel03SaxReader> i
 			case NumberRecord.sid: // 数字类型
 				final NumberRecord numrec = (NumberRecord) record;
 				final String formatString = formatListener.getFormatString(numrec);
-				if (formatString.contains(StrUtil.DOT)) {
+				if (StrUtil.contains(formatString, StrUtil.DOT)) {
 					//浮点数
 					value = numrec.getValue();
-				} else if (formatString.contains(StrUtil.SLASH) || formatString.contains(StrUtil.COLON)) {
+				} else if (StrUtil.containsAny(formatString, StrUtil.SLASH, StrUtil.COLON, "年", "月", "日", "时", "分", "秒")) {
 					//日期
 					value = ExcelSaxUtil.getDateValue(numrec.getValue());
 				} else {