Compare commits

..

No commits in common. "master" and "Chat2DB-Pro-patch-5" have entirely different histories.

37 changed files with 233 additions and 641 deletions

View File

@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
java: [ 8, 11, 17, 21] java: [ 8, 11, 17]
distribution: [ 'adopt' ] distribution: [ 'adopt' ]
fail-fast: false fail-fast: false
max-parallel: 4 max-parallel: 4
@ -37,7 +37,7 @@ jobs:
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
distribution: ${{ matrix.distribution }} distribution: ${{ matrix.distribution }}
- name: Cache local Maven repository - name: Cache local Maven repository
uses: actions/cache@main uses: actions/cache@v3
with: with:
path: ~/.m2/repository path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
@ -46,11 +46,7 @@ jobs:
- name: Chmod - name: Chmod
run: chmod +x mvnw run: chmod +x mvnw
- name: Test with Maven - name: Test with Maven
if: ${{ matrix.java == '8' }}
run: ./mvnw test -B -Dmaven.test.skip=false run: ./mvnw test -B -Dmaven.test.skip=false
- name: Test with Maven
if: ${{ matrix.java != '8' }}
run: ./mvnw test -B -Dmaven.test.skip=false -DargLine="--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/sun.reflect.annotation=ALL-UNNAMED"
- name: Maven Build - name: Maven Build
run: ./mvnw install -B -V run: ./mvnw install -B -V
- name: Java Doc - name: Java Doc

View File

@ -37,7 +37,7 @@ jobs:
server-username: MAVEN_USERNAME server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD server-password: MAVEN_PASSWORD
- name: Cache local Maven repository - name: Cache local Maven repository
uses: actions/cache@main uses: actions/cache@v3
with: with:
path: ~/.m2/repository path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}

View File

@ -7,22 +7,9 @@ EasyExcel
[![License](http://img.shields.io/:license-apache-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) [![License](http://img.shields.io/:license-apache-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
[![](https://img.shields.io/badge/EasyExcel-%E6%9F%A5%E7%9C%8B%E8%B4%A1%E7%8C%AE%E6%8E%92%E8%A1%8C%E6%A6%9C-orange)](https://opensource.alibaba.com/contribution_leaderboard/details?projectValue=easyexcel) [![](https://img.shields.io/badge/EasyExcel-%E6%9F%A5%E7%9C%8B%E8%B4%A1%E7%8C%AE%E6%8E%92%E8%A1%8C%E6%A6%9C-orange)](https://opensource.alibaba.com/contribution_leaderboard/details?projectValue=easyexcel)
# 维护公告
尊敬的EasyExcel用户们
首先我们想表达最深的谢意感谢您长期以来对EasyExcel的信任与支持。在这段旅程中EasyExcel有幸陪伴众多开发者和企业共同成长见证了无数数据处理任务的高效完成。
近期我们注意到市场上出现了更多优秀的数据处理工具和解决方案为用户提供了更丰富的选择。为了确保每位用户都能享受到最佳的体验和服务我们决定采取一项重要措施EasyExcel将逐步进入维护模式并给予用户充足的时间评估并迁移到其他产品。同时我们也欢迎并乐于见到社区内外分享关于同类优秀产品的使用心得和迁移经验共同促进技术生态的健康发展。
请放心即使进入维护模式我们仍会确保EasyExcel的基本功能稳定运行会进行Bug修复但不再主动新增功能。我们相信通过大家的共同努力每一段代码、每一个项目都将继续在各自的领域发光发热服务于更广泛的用户群体。
再次感谢您对EasyExcel的支持与理解期待在技术的广阔天地里我们能以新的形式再度携手共创辉煌。
祝您在未来的工作与学习中一切顺利!
阿里巴巴EasyExcel团队敬上
# 新手必读 # 新手必读
* 新手必读:🔥🔥🔥 [必读!!!](https://mp.weixin.qq.com/s/8RCyyx1EspiDPFnoYMx-Kw)
* 官方网站:[https://easyexcel.opensource.alibaba.com/](https://easyexcel.opensource.alibaba.com/) * 官方网站:[https://easyexcel.opensource.alibaba.com/](https://easyexcel.opensource.alibaba.com/)
* github地址[https://github.com/alibaba/easyexcel](https://github.com/alibaba/easyexcel) * github地址[https://github.com/alibaba/easyexcel](https://github.com/alibaba/easyexcel)
* gitee地址[https://gitee.com/easyexcel/easyexcel](https://gitee.com/easyexcel/easyexcel) * gitee地址[https://gitee.com/easyexcel/easyexcel](https://gitee.com/easyexcel/easyexcel)
@ -33,6 +20,15 @@ EasyExcel
Java解析、生成Excel比较有名的框架有Apache poi、jxl。但他们都存在一个严重的问题就是非常的耗内存poi有一套SAX模式的API可以一定程度的解决一些内存溢出的问题但POI还是有一些缺陷比如07版Excel解压缩以及解压后存储都是在内存中完成的内存消耗依然很大。 Java解析、生成Excel比较有名的框架有Apache poi、jxl。但他们都存在一个严重的问题就是非常的耗内存poi有一套SAX模式的API可以一定程度的解决一些内存溢出的问题但POI还是有一些缺陷比如07版Excel解压缩以及解压后存储都是在内存中完成的内存消耗依然很大。
easyexcel重写了poi对07版Excel的解析一个3M的excel用POI sax解析依然需要100M左右内存改用easyexcel可以降低到几M并且再大的excel也不会出现内存溢出03版依赖POI的sax模式在上层做了模型转换的封装让使用者更加简单方便 easyexcel重写了poi对07版Excel的解析一个3M的excel用POI sax解析依然需要100M左右内存改用easyexcel可以降低到几M并且再大的excel也不会出现内存溢出03版依赖POI的sax模式在上层做了模型转换的封装让使用者更加简单方便
# 🔥作者强烈推荐的数据库管理工具Chat2DB
AI 驱动的数据库管理、数据分析工具支持Mysql、pg、oracle、sqlserver、redis等10多种数据库
* Github 地址: [https://github.com/chat2db/Chat2DB](https://github.com/chat2db/Chat2DB)
* 官网:[https://chat2db-ai.com](https://chat2db-ai.com)
<p align="center">
<a href="https://chat2db.ai/" target="_blank">
<img src="https://chat2db-cdn.oss-us-west-1.aliyuncs.com/website/img/cover.png" alt="Chat2DB" />
</a>
</p>
# 16M内存23秒读取75M(46W行25列)的Excel3.2.1+版本) # 16M内存23秒读取75M(46W行25列)的Excel3.2.1+版本)
@ -47,7 +43,7 @@ easyexcel重写了poi对07版Excel的解析一个3M的excel用POI sax解析
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId> <artifactId>easyexcel</artifactId>
<version>4.0.3</version> <version>3.3.4</version>
</dependency> </dependency>
``` ```
@ -101,6 +97,10 @@ easyexcel重写了poi对07版Excel的解析一个3M的excel用POI sax解析
[钉钉12群(已满):27210038956](https://qr.dingtalk.com/action/joingroup?code=v1,k1,3mKi7VTGlYO+IsDX5n7sYYm2Qrlm220kMBPsJFzKRis=&_dt_no_comment=1&origin=11) [钉钉12群(已满):27210038956](https://qr.dingtalk.com/action/joingroup?code=v1,k1,3mKi7VTGlYO+IsDX5n7sYYm2Qrlm220kMBPsJFzKRis=&_dt_no_comment=1&origin=11)
[钉钉13群:83695000992](https://qr.dingtalk.com/action/joingroup?code=v1,k1,2JFUbWfxD1fGiq7LRW+mYjcK7s7onp/s1ZqOvfzkFGE=&_dt_no_comment=1&origin=11) [钉钉13群:83695000992](https://qr.dingtalk.com/action/joingroup?code=v1,k1,2JFUbWfxD1fGiq7LRW+mYjcK7s7onp/s1ZqOvfzkFGE=&_dt_no_comment=1&origin=11)
## 关注作者:程序员小獭
![qrcode_for_gh_c43212c8d0ed_258](https://github.com/alibaba/easyexcel/assets/22975773/13ceff34-d547-421b-b9a9-04f388792099)
# 维护者 # 维护者

View File

@ -28,6 +28,10 @@
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId> <artifactId>commons-csv</artifactId>
@ -36,5 +40,9 @@
<groupId>org.ehcache</groupId> <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId> <artifactId>ehcache</artifactId>
</dependency> </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -33,6 +33,7 @@ import com.alibaba.excel.util.SheetUtils;
import com.alibaba.excel.util.StringUtils; import com.alibaba.excel.util.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackageAccess; import org.apache.poi.openxml4j.opc.PackageAccess;
@ -42,9 +43,10 @@ import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
import org.apache.poi.openxml4j.opc.PackagingURIHelper; import org.apache.poi.openxml4j.opc.PackagingURIHelper;
import org.apache.poi.ss.util.CellAddress; import org.apache.poi.ss.util.CellAddress;
import org.apache.poi.xssf.eventusermodel.XSSFReader; import org.apache.poi.xssf.eventusermodel.XSSFReader;
import org.apache.poi.xssf.model.Comments;
import org.apache.poi.xssf.model.CommentsTable; import org.apache.poi.xssf.model.CommentsTable;
import org.apache.poi.xssf.model.SharedStringsTable;
import org.apache.poi.xssf.usermodel.XSSFComment; import org.apache.poi.xssf.usermodel.XSSFComment;
import org.apache.poi.xssf.usermodel.XSSFRelation;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbookPr; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbookPr;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.WorkbookDocument; import org.openxmlformats.schemas.spreadsheetml.x2006.main.WorkbookDocument;
@ -121,9 +123,9 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor {
sheetList.add(new ReadSheet(index, ite.getSheetName())); sheetList.add(new ReadSheet(index, ite.getSheetName()));
sheetMap.put(index, inputStream); sheetMap.put(index, inputStream);
if (xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.COMMENT)) { if (xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.COMMENT)) {
Comments comments = ite.getSheetComments(); CommentsTable commentsTable = ite.getSheetComments();
if (comments instanceof CommentsTable) { if (null != commentsTable) {
commentsTableMap.put(index, (CommentsTable) comments); commentsTableMap.put(index, commentsTable);
} }
} }
if (xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.HYPERLINK)) { if (xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.HYPERLINK)) {
@ -179,7 +181,7 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor {
} }
private void analysisSharedStringsTable(InputStream sharedStringsTableInputStream, private void analysisSharedStringsTable(InputStream sharedStringsTableInputStream,
XlsxReadWorkbookHolder xlsxReadWorkbookHolder) { XlsxReadWorkbookHolder xlsxReadWorkbookHolder) throws Exception {
ContentHandler handler = new SharedStringsTableHandler(xlsxReadWorkbookHolder.getReadCache()); ContentHandler handler = new SharedStringsTableHandler(xlsxReadWorkbookHolder.getReadCache());
parseXmlSource(sharedStringsTableInputStream, handler); parseXmlSource(sharedStringsTableInputStream, handler);
xlsxReadWorkbookHolder.getReadCache().putFinished(); xlsxReadWorkbookHolder.getReadCache().putFinished();
@ -199,7 +201,7 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor {
} }
File readTempFile = FileUtils.createCacheTmpFile(); File readTempFile = FileUtils.createCacheTmpFile();
xlsxReadWorkbookHolder.setTempFile(readTempFile); xlsxReadWorkbookHolder.setTempFile(readTempFile);
File tempFile = new File(readTempFile.getPath(), UUID.randomUUID() + ".xlsx"); File tempFile = new File(readTempFile.getPath(), UUID.randomUUID().toString() + ".xlsx");
if (decryptedStream != null) { if (decryptedStream != null) {
FileUtils.writeToFile(tempFile, decryptedStream, false); FileUtils.writeToFile(tempFile, decryptedStream, false);
} else { } else {

View File

@ -4,7 +4,6 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import com.alibaba.excel.util.MapUtils; import com.alibaba.excel.util.MapUtils;
import com.alibaba.excel.util.StringUtils;
/** /**
* Excel's built-in format conversion.Currently only supports Chinese. * Excel's built-in format conversion.Currently only supports Chinese.
@ -21,116 +20,8 @@ import com.alibaba.excel.util.StringUtils;
**/ **/
public class BuiltinFormats { public class BuiltinFormats {
private static final String RESERVED = "reserved-";
public static short GENERAL = 0; public static short GENERAL = 0;
public static final String[] BUILTIN_FORMATS_ALL_LANGUAGES = {
// 0
"General",
// 1
"0",
// 2
"0.00",
// 3
"#,##0",
// 4
"#,##0.00",
// 5
"\"\"#,##0_);(\"\"#,##0)",
// 6
"\"\"#,##0_);[Red](\"\"#,##0)",
// 7
"\"\"#,##0.00_);(\"\"#,##0.00)",
// 8
"\"\"#,##0.00_);[Red](\"\"#,##0.00)",
// 9
"0%",
// 10
"0.00%",
// 11
"0.00E+00",
// 12
"# ?/?",
// 13
"# ??/??",
// 14
// The official documentation shows "m/d/yy", but the actual test is "yyyy/m/d".
"yyyy/m/d",
// 15
"d-mmm-yy",
// 16
"d-mmm",
// 17
"mmm-yy",
// 18
"h:mm AM/PM",
// 19
"h:mm:ss AM/PM",
// 20
"h:mm",
// 21
"h:mm:ss",
// 22
// The official documentation shows "m/d/yy h:mm", but the actual test is "yyyy-m-d h:mm".
"yyyy-m-d h:mm",
// 23-36 No specific correspondence found in the official documentation.
// 23
null,
// 24
null,
// 25
null,
// 26
null,
// 27
null,
// 28
null,
// 29
null,
// 30
null,
// 31
null,
// 32
null,
// 33
null,
// 34
null,
// 35
null,
// 36
null,
// 37
"#,##0_);(#,##0)",
// 38
"#,##0_);[Red](#,##0)",
// 39
"#,##0.00_);(#,##0.00)",
// 40
"#,##0.00_);[Red](#,##0.00)",
// 41
"_(* #,##0_);_(* (#,##0);_(* \"-\"_);_(@_)",
// 42
"_(\"\"* #,##0_);_(\"\"* (#,##0);_(\"\"* \"-\"_);_(@_)",
// 43
"_(* #,##0.00_);_(* (#,##0.00);_(* \"-\"??_);_(@_)",
// 44
"_(\"\"* #,##0.00_);_(\"\"* (#,##0.00);_(\"\"* \"-\"??_);_(@_)",
// 45
"mm:ss",
// 46
"[h]:mm:ss",
// 47
"mm:ss.0",
// 48
"##0.0E+0",
// 49
"@",
};
public static final String[] BUILTIN_FORMATS_CN = { public static final String[] BUILTIN_FORMATS_CN = {
// 0 // 0
"General", "General",
@ -480,26 +371,8 @@ public class BuiltinFormats {
public static final short MIN_CUSTOM_DATA_FORMAT_INDEX = 82; public static final short MIN_CUSTOM_DATA_FORMAT_INDEX = 82;
public static String getBuiltinFormat(Short index, String defaultFormat, Locale locale) { public static String getBuiltinFormat(Short index, String defaultFormat, Locale locale) {
if (index == null || index <= 0) {
return defaultFormat;
}
// Give priority to checking if it is the default value for all languages
if (index < BUILTIN_FORMATS_ALL_LANGUAGES.length) {
String format = BUILTIN_FORMATS_ALL_LANGUAGES[index];
if (format != null) {
return format;
}
}
// In other cases, give priority to using the externally provided format
if (!StringUtils.isEmpty(defaultFormat) && !defaultFormat.startsWith(RESERVED)) {
return defaultFormat;
}
// Finally, try using the built-in format
String[] builtinFormat = switchBuiltinFormats(locale); String[] builtinFormat = switchBuiltinFormats(locale);
if (index >= builtinFormat.length) { if (index == null || index < 0 || index >= builtinFormat.length) {
return defaultFormat; return defaultFormat;
} }
return builtinFormat[index]; return builtinFormat[index];

View File

@ -227,6 +227,11 @@ public class CsvCell extends CellBase {
return getCellType(); return getCellType();
} }
@Override
public CellType getCachedFormulaResultTypeEnum() {
return getCellType();
}
@Override @Override
public String getCellFormula() { public String getCellFormula() {
if (formulaData == null) { if (formulaData == null) {

View File

@ -76,7 +76,7 @@ public class CsvCellStyle implements CellStyle {
} }
@Override @Override
public int getFontIndex() { public short getFontIndex() {
return 0; return 0;
} }
@ -125,6 +125,11 @@ public class CsvCellStyle implements CellStyle {
return null; return null;
} }
@Override
public HorizontalAlignment getAlignmentEnum() {
return null;
}
@Override @Override
public void setWrapText(boolean wrapped) { public void setWrapText(boolean wrapped) {
@ -145,6 +150,11 @@ public class CsvCellStyle implements CellStyle {
return null; return null;
} }
@Override
public VerticalAlignment getVerticalAlignmentEnum() {
return null;
}
@Override @Override
public void setRotation(short rotation) { public void setRotation(short rotation) {
@ -175,6 +185,11 @@ public class CsvCellStyle implements CellStyle {
return null; return null;
} }
@Override
public BorderStyle getBorderLeftEnum() {
return null;
}
@Override @Override
public void setBorderRight(BorderStyle border) { public void setBorderRight(BorderStyle border) {
@ -185,6 +200,11 @@ public class CsvCellStyle implements CellStyle {
return null; return null;
} }
@Override
public BorderStyle getBorderRightEnum() {
return null;
}
@Override @Override
public void setBorderTop(BorderStyle border) { public void setBorderTop(BorderStyle border) {
@ -195,6 +215,11 @@ public class CsvCellStyle implements CellStyle {
return null; return null;
} }
@Override
public BorderStyle getBorderTopEnum() {
return null;
}
@Override @Override
public void setBorderBottom(BorderStyle border) { public void setBorderBottom(BorderStyle border) {
@ -205,6 +230,11 @@ public class CsvCellStyle implements CellStyle {
return null; return null;
} }
@Override
public BorderStyle getBorderBottomEnum() {
return null;
}
@Override @Override
public void setLeftBorderColor(short color) { public void setLeftBorderColor(short color) {
@ -256,12 +286,12 @@ public class CsvCellStyle implements CellStyle {
} }
@Override @Override
public void setFillBackgroundColor(short bg) { public FillPatternType getFillPatternEnum() {
return null;
} }
@Override @Override
public void setFillBackgroundColor(Color color) { public void setFillBackgroundColor(short bg) {
} }
@ -280,11 +310,6 @@ public class CsvCellStyle implements CellStyle {
} }
@Override
public void setFillForegroundColor(Color color) {
}
@Override @Override
public short getFillForegroundColor() { public short getFillForegroundColor() {
return 0; return 0;

View File

@ -39,8 +39,6 @@ import org.apache.poi.ss.usermodel.Drawing;
import org.apache.poi.ss.usermodel.Footer; import org.apache.poi.ss.usermodel.Footer;
import org.apache.poi.ss.usermodel.Header; import org.apache.poi.ss.usermodel.Header;
import org.apache.poi.ss.usermodel.Hyperlink; import org.apache.poi.ss.usermodel.Hyperlink;
import org.apache.poi.ss.usermodel.PageMargin;
import org.apache.poi.ss.usermodel.PaneType;
import org.apache.poi.ss.usermodel.PrintSetup; import org.apache.poi.ss.usermodel.PrintSetup;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
@ -413,21 +411,11 @@ public class CsvSheet implements Sheet, Closeable {
return 0; return 0;
} }
@Override
public double getMargin(PageMargin pageMargin) {
return 0;
}
@Override @Override
public void setMargin(short margin, double size) { public void setMargin(short margin, double size) {
} }
@Override
public void setMargin(PageMargin pageMargin, double v) {
}
@Override @Override
public boolean getProtect() { public boolean getProtect() {
return false; return false;
@ -493,11 +481,6 @@ public class CsvSheet implements Sheet, Closeable {
} }
@Override
public void createSplitPane(int i, int i1, int i2, int i3, PaneType paneType) {
}
@Override @Override
public PaneInformation getPaneInformation() { public PaneInformation getPaneInformation() {
return null; return null;

View File

@ -12,9 +12,7 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.formula.EvaluationWorkbook;
import org.apache.poi.ss.formula.udf.UDFFinder; import org.apache.poi.ss.formula.udf.UDFFinder;
import org.apache.poi.ss.usermodel.CellReferenceType;
import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CreationHelper; import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.DataFormat; import org.apache.poi.ss.usermodel.DataFormat;
@ -42,9 +40,10 @@ public class CsvWorkbook implements Workbook {
/** /**
* true if date uses 1904 windowing, or false if using 1900 date windowing. * true if date uses 1904 windowing, or false if using 1900 date windowing.
* <p> *
* default is false * default is false
* *
* @return
*/ */
private Boolean use1904windowing; private Boolean use1904windowing;
@ -55,7 +54,7 @@ public class CsvWorkbook implements Workbook {
/** /**
* Whether to use scientific Format. * Whether to use scientific Format.
* <p> *
* default is false * default is false
*/ */
private Boolean useScientificFormat; private Boolean useScientificFormat;
@ -201,7 +200,7 @@ public class CsvWorkbook implements Workbook {
} }
@Override @Override
public int getNumberOfFonts() { public short getNumberOfFonts() {
return 0; return 0;
} }
@ -210,6 +209,11 @@ public class CsvWorkbook implements Workbook {
return 0; return 0;
} }
@Override
public Font getFontAt(short idx) {
return null;
}
@Override @Override
public Font getFontAt(int idx) { public Font getFontAt(int idx) {
return null; return null;
@ -268,11 +272,31 @@ public class CsvWorkbook implements Workbook {
return null; return null;
} }
@Override
public Name getNameAt(int nameIndex) {
return null;
}
@Override @Override
public Name createName() { public Name createName() {
return null; return null;
} }
@Override
public int getNameIndex(String name) {
return 0;
}
@Override
public void removeName(int index) {
}
@Override
public void removeName(String name) {
}
@Override @Override
public void removeName(Name name) { public void removeName(Name name) {
@ -393,25 +417,10 @@ public class CsvWorkbook implements Workbook {
} }
@Override @Override
public int addOlePackage(byte[] oleData, String label, String fileName, String command) { public int addOlePackage(byte[] oleData, String label, String fileName, String command) throws IOException {
return 0; return 0;
} }
@Override
public EvaluationWorkbook createEvaluationWorkbook() {
return null;
}
@Override
public CellReferenceType getCellReferenceType() {
return null;
}
@Override
public void setCellReferenceType(CellReferenceType cellReferenceType) {
}
@Override @Override
public Iterator<Sheet> iterator() { public Iterator<Sheet> iterator() {
return null; return null;

View File

@ -4,6 +4,9 @@ import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Map; import java.util.Map;
import javax.print.DocFlavor.STRING;
import com.alibaba.excel.constant.EasyExcelConstants;
import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.enums.CellDataTypeEnum; import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.enums.HeadKindEnum; import com.alibaba.excel.enums.HeadKindEnum;
@ -14,13 +17,15 @@ import com.alibaba.excel.metadata.data.DataFormatData;
import com.alibaba.excel.metadata.data.ReadCellData; import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.read.metadata.holder.ReadSheetHolder; import com.alibaba.excel.read.metadata.holder.ReadSheetHolder;
import com.alibaba.excel.read.metadata.property.ExcelReadHeadProperty; import com.alibaba.excel.read.metadata.property.ExcelReadHeadProperty;
import com.alibaba.excel.support.cglib.beans.BeanMap;
import com.alibaba.excel.util.BeanMapUtils; import com.alibaba.excel.util.BeanMapUtils;
import com.alibaba.excel.util.BooleanUtils;
import com.alibaba.excel.util.ClassUtils; import com.alibaba.excel.util.ClassUtils;
import com.alibaba.excel.util.ConverterUtils; import com.alibaba.excel.util.ConverterUtils;
import com.alibaba.excel.util.DateUtils; import com.alibaba.excel.util.DateUtils;
import com.alibaba.excel.util.MapUtils; import com.alibaba.excel.util.MapUtils;
import com.alibaba.excel.util.StringUtils;
import org.springframework.cglib.beans.BeanMap;
/** /**
* Convert to the object the user needs * Convert to the object the user needs

View File

@ -1,7 +1,7 @@
package com.alibaba.excel.util; package com.alibaba.excel.util;
import com.alibaba.excel.support.cglib.beans.BeanMap; import org.springframework.cglib.beans.BeanMap;
import com.alibaba.excel.support.cglib.core.DefaultNamingPolicy; import org.springframework.cglib.core.DefaultNamingPolicy;
/** /**
* bean utils * bean utils

View File

@ -33,7 +33,6 @@ import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.alibaba.excel.metadata.property.FontProperty; import com.alibaba.excel.metadata.property.FontProperty;
import com.alibaba.excel.metadata.property.NumberFormatProperty; import com.alibaba.excel.metadata.property.NumberFormatProperty;
import com.alibaba.excel.metadata.property.StyleProperty; import com.alibaba.excel.metadata.property.StyleProperty;
import com.alibaba.excel.support.cglib.beans.BeanMap;
import com.alibaba.excel.write.metadata.holder.WriteHolder; import com.alibaba.excel.write.metadata.holder.WriteHolder;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -42,6 +41,7 @@ import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.cglib.beans.BeanMap;
/** /**
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -1,20 +1,3 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package com.alibaba.excel.util; package com.alibaba.excel.util;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -26,16 +9,13 @@ import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.TimeZone;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.util.LocaleUtil;
/** /**
* Date utils * Date utils
@ -83,15 +63,6 @@ public class DateUtils {
public static String defaultLocalDateFormat = DATE_FORMAT_10; public static String defaultLocalDateFormat = DATE_FORMAT_10;
public static final int SECONDS_PER_MINUTE = 60;
public static final int MINUTES_PER_HOUR = 60;
public static final int HOURS_PER_DAY = 24;
public static final int SECONDS_PER_DAY = (HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE);
// used to specify that date is invalid
private static final int BAD_DATE = -1;
public static final long DAY_MILLISECONDS = SECONDS_PER_DAY * 1000L;
private DateUtils() {} private DateUtils() {}
/** /**
@ -330,75 +301,13 @@ public class DateUtils {
* @return Java representation of the date, or null if date is not a valid Excel date * @return Java representation of the date, or null if date is not a valid Excel date
*/ */
public static Date getJavaDate(double date, boolean use1904windowing) { public static Date getJavaDate(double date, boolean use1904windowing) {
Calendar calendar = getJavaCalendar(date, use1904windowing, null, true); //To calculate the Date, in the use of `org.apache.poi.ss.usermodel.DateUtil.getJavaDate(double, boolean,
return calendar == null ? null : calendar.getTime(); // java.util.TimeZone, boolean), Date when similar `2023-01-01 00:00:00.500`, returns the`2023-01-01
// 00:00:01`, but excel in fact shows the `2023-01-01 00:00:00`.
// `org.apache.poi.ss.usermodel.DateUtil.getLocalDateTime(double, boolean, boolean)` There is no problem.
return Date.from(getLocalDateTime(date, use1904windowing).atZone(ZoneId.systemDefault()).toInstant());
} }
/**
* Get EXCEL date as Java Calendar with given time zone.
* @param date The Excel date.
* @param use1904windowing true if date uses 1904 windowing,
* or false if using 1900 date windowing.
* @param timeZone The TimeZone to evaluate the date in
* @param roundSeconds round to closest second
* @return Java representation of the date, or null if date is not a valid Excel date
*/
public static Calendar getJavaCalendar(double date, boolean use1904windowing, TimeZone timeZone, boolean roundSeconds) {
if (!isValidExcelDate(date)) {
return null;
}
int wholeDays = (int)Math.floor(date);
int millisecondsInDay = (int)((date - wholeDays) * DAY_MILLISECONDS + 0.5);
Calendar calendar;
if (timeZone != null) {
calendar = LocaleUtil.getLocaleCalendar(timeZone);
} else {
calendar = LocaleUtil.getLocaleCalendar(); // using default time-zone
}
setCalendar(calendar, wholeDays, millisecondsInDay, use1904windowing, roundSeconds);
return calendar;
}
public static void setCalendar(Calendar calendar, int wholeDays,
int millisecondsInDay, boolean use1904windowing, boolean roundSeconds) {
int startYear = 1900;
int dayAdjust = -1; // Excel thinks 2/29/1900 is a valid date, which it isn't
if (use1904windowing) {
startYear = 1904;
dayAdjust = 1; // 1904 date windowing uses 1/2/1904 as the first day
}
else if (wholeDays < 61) {
// Date is prior to 3/1/1900, so adjust because Excel thinks 2/29/1900 exists
// If Excel date == 2/29/1900, will become 3/1/1900 in Java representation
dayAdjust = 0;
}
calendar.set(startYear, Calendar.JANUARY, wholeDays + dayAdjust, 0, 0, 0);
calendar.set(Calendar.MILLISECOND, millisecondsInDay);
if (calendar.get(Calendar.MILLISECOND) == 0) {
calendar.clear(Calendar.MILLISECOND);
}
if (roundSeconds) {
// This is different from poi where you need to change 500 to 499
calendar.add(Calendar.MILLISECOND, 499);
calendar.clear(Calendar.MILLISECOND);
}
}
/**
* Given a double, checks if it is a valid Excel date.
*
* @return true if valid
* @param value the double value
*/
public static boolean isValidExcelDate(double value)
{
return (value > -Double.MIN_VALUE);
}
/** /**
* Given an Excel date with either 1900 or 1904 date windowing, * Given an Excel date with either 1900 or 1904 date windowing,
* converts it to a java.time.LocalDateTime. * converts it to a java.time.LocalDateTime.
@ -561,10 +470,31 @@ public class DateUtils {
case 0x14: case 0x14:
case 0x15: case 0x15:
case 0x16: case 0x16:
// 45-47 // 27-36
case 0x1b:
case 0x1c:
case 0x1d:
case 0x1e:
case 0x1f:
case 0x20:
case 0x21:
case 0x22:
case 0x23:
case 0x24:
// 45-47
case 0x2d: case 0x2d:
case 0x2e: case 0x2e:
case 0x2f: case 0x2f:
// 50-58
case 0x32:
case 0x33:
case 0x34:
case 0x35:
case 0x36:
case 0x37:
case 0x38:
case 0x39:
case 0x3a:
return true; return true;
} }
return false; return false;

View File

@ -1,136 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package com.alibaba.excel.util;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.FileAttribute;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.poi.util.DefaultTempFileCreationStrategy;
import org.apache.poi.util.TempFileCreationStrategy;
import static org.apache.poi.util.TempFile.JAVA_IO_TMPDIR;
/**
* In the scenario where `poifiles` are cleaned up, the {@link DefaultTempFileCreationStrategy} will throw a
* java.nio.file.NoSuchFileException. Therefore, it is necessary to verify the existence of the temporary file every
* time it is created.
*
* @author Jiaju Zhuang
*/
public class EasyExcelTempFileCreationStrategy implements TempFileCreationStrategy {
/**
* Name of POI files directory in temporary directory.
*/
public static final String POIFILES = "poifiles";
/**
* To use files.deleteOnExit after clean JVM exit, set the <code>-Dpoi.delete.tmp.files.on.exit</code> JVM property
*/
public static final String DELETE_FILES_ON_EXIT = "poi.delete.tmp.files.on.exit";
/**
* The directory where the temporary files will be created (<code>null</code> to use the default directory).
*/
private volatile File dir;
/**
* The lock to make dir initialized only once.
*/
private final Lock dirLock = new ReentrantLock();
/**
* Creates the strategy so that it creates the temporary files in the default directory.
*
* @see File#createTempFile(String, String)
*/
public EasyExcelTempFileCreationStrategy() {
this(null);
}
/**
* Creates the strategy allowing to set the
*
* @param dir The directory where the temporary files will be created (<code>null</code> to use the default
* directory).
* @see Files#createTempFile(Path, String, String, FileAttribute[])
*/
public EasyExcelTempFileCreationStrategy(File dir) {
this.dir = dir;
}
private void createPOIFilesDirectory() throws IOException {
// Create our temp dir only once by double-checked locking
// The directory is not deleted, even if it was created by this TempFileCreationStrategy
if (dir == null || !dir.exists()) {
dirLock.lock();
try {
if (dir == null || !dir.exists()) {
String tmpDir = System.getProperty(JAVA_IO_TMPDIR);
if (tmpDir == null) {
throw new IOException("System's temporary directory not defined - set the -D" + JAVA_IO_TMPDIR
+ " jvm property!");
}
Path dirPath = Paths.get(tmpDir, POIFILES);
dir = Files.createDirectories(dirPath).toFile();
}
} finally {
dirLock.unlock();
}
return;
}
}
@Override
public File createTempFile(String prefix, String suffix) throws IOException {
// Identify and create our temp dir, if needed
createPOIFilesDirectory();
// Generate a unique new filename
File newFile = Files.createTempFile(dir.toPath(), prefix, suffix).toFile();
// Set the delete on exit flag, but only when explicitly disabled
if (System.getProperty(DELETE_FILES_ON_EXIT) != null) {
newFile.deleteOnExit();
}
// All done
return newFile;
}
/* (non-JavaDoc) Created directory path is <JAVA_IO_TMPDIR>/poifiles/prefix0123456789 */
@Override
public File createTempDirectory(String prefix) throws IOException {
// Identify and create our temp dir, if needed
createPOIFilesDirectory();
// Generate a unique new filename
File newDirectory = Files.createTempDirectory(dir.toPath(), prefix).toFile();
//this method appears to be only used in tests, so it is probably ok to use deleteOnExit
newDirectory.deleteOnExit();
// All done
return newDirectory;
}
}

View File

@ -5,7 +5,8 @@ import java.lang.reflect.Modifier;
import java.util.Map; import java.util.Map;
import com.alibaba.excel.metadata.NullObject; import com.alibaba.excel.metadata.NullObject;
import com.alibaba.excel.support.cglib.beans.BeanMap;
import org.springframework.cglib.beans.BeanMap;
/** /**
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -12,6 +12,7 @@ import java.util.UUID;
import com.alibaba.excel.exception.ExcelAnalysisException; import com.alibaba.excel.exception.ExcelAnalysisException;
import com.alibaba.excel.exception.ExcelCommonException; import com.alibaba.excel.exception.ExcelCommonException;
import org.apache.poi.util.DefaultTempFileCreationStrategy;
import org.apache.poi.util.TempFile; import org.apache.poi.util.TempFile;
/** /**
@ -110,7 +111,7 @@ public class FileUtils {
/** /**
* Write inputStream to file * Write inputStream to file
* *
* @param file file * @param file file
* @param inputStream inputStream * @param inputStream inputStream
*/ */
public static void writeToFile(File file, InputStream inputStream) { public static void writeToFile(File file, InputStream inputStream) {
@ -120,8 +121,8 @@ public class FileUtils {
/** /**
* Write inputStream to file * Write inputStream to file
* *
* @param file file * @param file file
* @param inputStream inputStream * @param inputStream inputStream
* @param closeInputStream closeInputStream * @param closeInputStream closeInputStream
*/ */
public static void writeToFile(File file, InputStream inputStream, boolean closeInputStream) { public static void writeToFile(File file, InputStream inputStream, boolean closeInputStream) {
@ -153,8 +154,11 @@ public class FileUtils {
} }
} }
public static void createPoiFilesDirectory() { public static void createPoiFilesDirectory() {
TempFile.setTempFileCreationStrategy(new EasyExcelTempFileCreationStrategy()); File poiFilesPathFile = new File(poiFilesPath);
createDirectory(poiFilesPathFile);
TempFile.setTempFileCreationStrategy(new DefaultTempFileCreationStrategy(poiFilesPathFile));
} }
public static File createCacheTmpFile() { public static File createCacheTmpFile() {
@ -167,6 +171,7 @@ public class FileUtils {
} }
/** /**
*
* @param directory * @param directory
*/ */
public static File createDirectory(File directory) { public static File createDirectory(File directory) {

View File

@ -1,10 +1,12 @@
package com.alibaba.excel.write.executor; package com.alibaba.excel.write.executor;
import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeMap;
import com.alibaba.excel.context.WriteContext; import com.alibaba.excel.context.WriteContext;
import com.alibaba.excel.enums.HeadKindEnum; import com.alibaba.excel.enums.HeadKindEnum;
@ -12,7 +14,6 @@ import com.alibaba.excel.metadata.FieldCache;
import com.alibaba.excel.metadata.FieldWrapper; import com.alibaba.excel.metadata.FieldWrapper;
import com.alibaba.excel.metadata.Head; import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.metadata.property.ExcelContentProperty; import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.alibaba.excel.support.cglib.beans.BeanMap;
import com.alibaba.excel.util.BeanMapUtils; import com.alibaba.excel.util.BeanMapUtils;
import com.alibaba.excel.util.ClassUtils; import com.alibaba.excel.util.ClassUtils;
import com.alibaba.excel.util.FieldUtils; import com.alibaba.excel.util.FieldUtils;
@ -29,6 +30,7 @@ import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.springframework.cglib.beans.BeanMap;
/** /**
* Add the data into excel * Add the data into excel

View File

@ -21,11 +21,11 @@
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId> <artifactId>spring-core</artifactId>
<version>5.3.37</version> <version>5.3.27</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>*</groupId> <groupId>org.springframework</groupId>
<artifactId>*</artifactId> <artifactId>spring-jcl</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
@ -49,7 +49,7 @@
<createDependencyReducedPom>true</createDependencyReducedPom> <createDependencyReducedPom>true</createDependencyReducedPom>
<!-- Make sure the transitive dependencies are written to the generated pom under <dependencies> --> <!-- Make sure the transitive dependencies are written to the generated pom under <dependencies> -->
<promoteTransitiveDependencies>true</promoteTransitiveDependencies> <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
<artifactSet> <artifactSet combine.self="override">
<includes> <includes>
<include>org.springframework:spring-core</include> <include>org.springframework:spring-core</include>
</includes> </includes>
@ -63,12 +63,6 @@
</includes> </includes>
</filter> </filter>
</filters> </filters>
<relocations>
<relocation>
<pattern>org.springframework</pattern>
<shadedPattern>com.alibaba.excel.support</shadedPattern>
</relocation>
</relocations>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>

View File

@ -21,7 +21,6 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>easyexcel-core</artifactId> <artifactId>easyexcel-core</artifactId>
@ -29,17 +28,17 @@
<dependency> <dependency>
<groupId>com.alibaba.fastjson2</groupId> <groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId> <artifactId>fastjson2</artifactId>
<version>2.0.51</version> <version>2.0.29</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<version>2.7.18</version> <version>2.7.11</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<version>2.7.18</version> <version>2.7.11</version>
</dependency> </dependency>
<!-- logback --> <!-- logback -->
@ -61,7 +60,7 @@
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
<version>1.5.6</version> <version>1.2.12</version>
</dependency> </dependency>
</dependencies> </dependencies>
@ -74,7 +73,7 @@
<includes> <includes>
<include>/com/alibaba/easyexcel/test/core/**/*.java</include> <include>/com/alibaba/easyexcel/test/core/**/*.java</include>
</includes> </includes>
<testFailureIgnore>false</testFailureIgnore> <testFailureIgnore>true</testFailureIgnore>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -13,7 +13,6 @@ import lombok.Setter;
public class DateFormatData { public class DateFormatData {
private String date; private String date;
private String dateStringCn; private String dateStringCn;
private String dateStringCn2;
private String dateStringUs; private String dateStringUs;
private String number; private String number;
private String numberStringCn; private String numberStringCn;

View File

@ -3,12 +3,9 @@ package com.alibaba.easyexcel.test.core.dataformat;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import com.alibaba.easyexcel.test.util.TestFileUtil; import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
@ -24,7 +21,6 @@ import org.junit.jupiter.api.TestMethodOrder;
@Slf4j @Slf4j
public class DateFormatTest { public class DateFormatTest {
private static File file07V2;
private static File file07; private static File file07;
private static File file03; private static File file03;
@ -32,8 +28,6 @@ public class DateFormatTest {
public static void init() { public static void init() {
file07 = TestFileUtil.readFile("dataformat" + File.separator + "dataformat.xlsx"); file07 = TestFileUtil.readFile("dataformat" + File.separator + "dataformat.xlsx");
file03 = TestFileUtil.readFile("dataformat" + File.separator + "dataformat.xls"); file03 = TestFileUtil.readFile("dataformat" + File.separator + "dataformat.xls");
file07V2 = TestFileUtil.readFile("dataformat" + File.separator + "dataformatv2.xlsx");
} }
@Test @Test
@ -48,39 +42,19 @@ public class DateFormatTest {
readUs(file03); readUs(file03);
} }
@Test
public void t03Read() {
List<Map<Integer, String>> dataMap = EasyExcel.read(file07V2).headRowNumber(0).doReadAllSync();
log.info("dataMap:{}", JSON.toJSONString(dataMap));
Assertions.assertEquals("15:00", dataMap.get(0).get(0));
Assertions.assertEquals("2023-1-01 00:00:00", dataMap.get(1).get(0));
Assertions.assertEquals("2023-1-01 00:00:00", dataMap.get(2).get(0));
Assertions.assertEquals("2023-1-01 00:00:01", dataMap.get(3).get(0));
Assertions.assertEquals("2023-1-01 00:00:00", dataMap.get(4).get(0));
Assertions.assertEquals("2023-1-01 00:00:00", dataMap.get(5).get(0));
Assertions.assertEquals("2023-1-01 00:00:01", dataMap.get(6).get(0));
}
private void readCn(File file) { private void readCn(File file) {
List<DateFormatData> list = List<DateFormatData> list =
EasyExcel.read(file, DateFormatData.class, null).locale(Locale.CHINA).sheet().doReadSync(); EasyExcel.read(file, DateFormatData.class, null).locale(Locale.CHINA).sheet().doReadSync();
for (DateFormatData data : list) { for (DateFormatData data : list) {
if (!Objects.equals(data.getDateStringCn(), data.getDate()) && !Objects.equals(data.getDateStringCn2(), if (data.getDateStringCn() != null && !data.getDateStringCn().equals(data.getDate())) {
data.getDate())) { log.info("date:cn:{},{}", data.getDateStringCn(), data.getDate());
log.info("date:cn:{},{},{}", data.getDateStringCn(), data.getDateStringCn2(), data.getDate());
} }
if (data.getNumberStringCn() != null && !data.getNumberStringCn().equals(data.getNumber())) { if (data.getNumberStringCn() != null && !data.getNumberStringCn().equals(data.getNumber())) {
log.info("number:cn{},{}", data.getNumberStringCn(), data.getNumber()); log.info("number:cn{},{}", data.getNumberStringCn(), data.getNumber());
} }
} }
for (DateFormatData data : list) { for (DateFormatData data : list) {
// The way dates are read in Chinese is different on Linux and Mac, so it is acceptable if it matches Assertions.assertEquals(data.getDateStringCn(), data.getDate());
// either one.
// For example, on Linux: 1-Jan -> 1-1月
// On Mac: 1-Jan -> 1-一月
Assertions.assertTrue(
Objects.equals(data.getDateStringCn(), data.getDate()) || Objects.equals(data.getDateStringCn2(),
data.getDate()));
Assertions.assertEquals(data.getNumberStringCn(), data.getNumber()); Assertions.assertEquals(data.getNumberStringCn(), data.getNumber());
} }
} }

View File

@ -16,7 +16,6 @@ import com.alibaba.excel.enums.CellExtraTypeEnum;
import com.alibaba.excel.read.listener.PageReadListener; import com.alibaba.excel.read.listener.PageReadListener;
import com.alibaba.excel.read.listener.ReadListener; import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.ReadSheet; import com.alibaba.excel.read.metadata.ReadSheet;
import com.alibaba.excel.read.metadata.holder.csv.CsvReadWorkbookHolder;
import com.alibaba.excel.util.ListUtils; import com.alibaba.excel.util.ListUtils;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
@ -310,28 +309,4 @@ public class ReadTest {
// 这里 只要然后读取第一个sheet 同步读取会自动finish // 这里 只要然后读取第一个sheet 同步读取会自动finish
EasyExcel.read(fileName, new NoModelDataListener()).sheet().doRead(); EasyExcel.read(fileName, new NoModelDataListener()).sheet().doRead();
} }
/**
* 自定义修改csv配置
*/
@Test
public void csvFormat() {
String fileName = TestFileUtil.getPath() + "demo" + File.separator + "demo.csv";
try (ExcelReader excelReader = EasyExcel.read(fileName, DemoData.class, new DemoDataListener()).build()) {
// 判断是 csv 文件
if (excelReader.analysisContext().readWorkbookHolder() instanceof CsvReadWorkbookHolder) {
CsvReadWorkbookHolder csvReadWorkbookHolder = (CsvReadWorkbookHolder)excelReader.analysisContext()
.readWorkbookHolder();
// 设置成逗号分隔 当然默认也是逗号分隔
// 这里要注意 withDelimiter 会重新生成一个 所以要放回去
csvReadWorkbookHolder.setCsvFormat(csvReadWorkbookHolder.getCsvFormat().withDelimiter(','));
}
// 拿到所有 sheet
List<ReadSheet> readSheetList = excelReader.excelExecutor().sheetList();
// 如果只想读取第一个 咋样传入参数即可
//ReadSheet readSheet = EasyExcel.readSheet(0).build();
excelReader.read(readSheetList);
}
}
} }

View File

@ -26,7 +26,7 @@ import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.util.CellReference; import org.apache.poi.hssf.util.CellReference;
import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.FillPatternType; import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.IndexedColors;
@ -52,7 +52,8 @@ public class Lock2Test {
File file = new File("/Users/zhuangjiaju/IdeaProjects/easyexcel/src/test/resources/converter/converter07.xlsx"); File file = new File("/Users/zhuangjiaju/IdeaProjects/easyexcel/src/test/resources/converter/converter07.xlsx");
List<Object> list = EasyExcel.read( List<Object> list = EasyExcel.read(
"/Users/zhuangjiaju/Downloads/证券投资基金估值表_外贸信托-稳盈淳享37号集合资金信托计划_2024-07-23(1).xls") "/Users/zhuangjiaju/IdeaProjects/easyexcel/easyexcel-test/target/test-classes"
+ "/simpleWrite1674051907397.xlsx")
//.useDefaultListener(false) //.useDefaultListener(false)
.sheet(0) .sheet(0)
.headRowNumber(0).doReadSync(); .headRowNumber(0).doReadSync();

View File

@ -10,6 +10,7 @@ import java.util.List;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@ -179,7 +180,7 @@ public class StyleTest {
private void isDate(Cell cell) { private void isDate(Cell cell) {
System.out.println( System.out.println(
DateUtil.isADateFormat(cell.getCellStyle().getDataFormat(), cell.getCellStyle().getDataFormatString())); DateUtil.isADateFormat(cell.getCellStyle().getDataFormat(), cell.getCellStyle().getDataFormatString()));
//System.out.println(HSSFDateUtil.isCellDateFormatted(cell)); System.out.println(HSSFDateUtil.isCellDateFormatted(cell));
DataFormatter f = new DataFormatter(); DataFormatter f = new DataFormatter();
System.out.println(f.formatCellValue(cell)); System.out.println(f.formatCellValue(cell));

View File

@ -1,8 +1,5 @@
package com.alibaba.easyexcel.test.temp; package com.alibaba.easyexcel.test.temp;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -138,11 +135,4 @@ public class WriteV33Test {
return list; return list;
} }
@Test
public void test4() throws Exception{
Path path= Files.createTempFile(new File("/Users/zhuangjiaju/test/test0422/test/xx").toPath(),System.currentTimeMillis()+"",".jpg");
System.out.println(path);
}
} }

View File

@ -3,14 +3,14 @@ package com.alibaba.easyexcel.test.temp;
import java.util.List; import java.util.List;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.cglib.beans.BeanMap;
import com.alibaba.excel.support.cglib.core.DebuggingClassWriter;
import com.alibaba.excel.util.BeanMapUtils; import com.alibaba.excel.util.BeanMapUtils;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.cglib.core.DebuggingClassWriter;
/** /**
* 临时测试 * 临时测试

View File

@ -38,7 +38,6 @@ import java.util.Observer;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.alibaba.excel.analysis.ExcelAnalyserImpl;
import org.apache.poi.ss.format.CellFormat; import org.apache.poi.ss.format.CellFormat;
import org.apache.poi.ss.format.CellFormatResult; import org.apache.poi.ss.format.CellFormatResult;
import org.apache.poi.ss.formula.ConditionalFormattingEvaluator; import org.apache.poi.ss.formula.ConditionalFormattingEvaluator;
@ -55,8 +54,8 @@ import org.apache.poi.ss.usermodel.FractionFormat;
import org.apache.poi.ss.util.DateFormatConverter; import org.apache.poi.ss.util.DateFormatConverter;
import org.apache.poi.ss.util.NumberToTextConverter; import org.apache.poi.ss.util.NumberToTextConverter;
import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.LocaleUtil;
import org.slf4j.Logger; import org.apache.poi.util.POILogFactory;
import org.slf4j.LoggerFactory; import org.apache.poi.util.POILogger;
/** /**
* DataFormatter contains methods for formatting the value stored in an Cell. This can be useful for reports and GUI * DataFormatter contains methods for formatting the value stored in an Cell. This can be useful for reports and GUI
@ -246,7 +245,7 @@ public class DataFormatter1 implements Observer {
/** /**
* For logging any problems we find * For logging any problems we find
*/ */
private static final Logger logger = LoggerFactory.getLogger(ExcelAnalyserImpl.class); private static POILogger logger = POILogFactory.getLogger(DataFormatter.class);
/** /**
* Creates a formatter using the {@link Locale#getDefault() default locale}. * Creates a formatter using the {@link Locale#getDefault() default locale}.
@ -359,7 +358,7 @@ public class DataFormatter1 implements Observer {
// Wrap and return (non-cachable - CellFormat does that) // Wrap and return (non-cachable - CellFormat does that)
return new CellFormatResultWrapper(cfmt.apply(cellValueO)); return new CellFormatResultWrapper(cfmt.apply(cellValueO));
} catch (Exception e) { } catch (Exception e) {
logger.warn("Formatting failed for format {}, falling back", formatStr, e); logger.log(POILogger.WARN, "Formatting failed for format " + formatStr + ", falling back", e);
} }
} }
@ -599,7 +598,7 @@ public class DataFormatter1 implements Observer {
try { try {
return new ExcelStyleDateFormatter(formatStr, dateSymbols); return new ExcelStyleDateFormatter(formatStr, dateSymbols);
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {
logger.debug("Formatting failed for format {}, falling back", formatStr, iae); logger.log(POILogger.DEBUG, "Formatting failed for format " + formatStr + ", falling back", iae);
// the pattern could not be parsed correctly, // the pattern could not be parsed correctly,
// so fall back to the default number format // so fall back to the default number format
return getDefaultFormat(cellValue); return getDefaultFormat(cellValue);
@ -760,7 +759,7 @@ public class DataFormatter1 implements Observer {
try { try {
return new InternalDecimalFormatWithScale(format, symbols); return new InternalDecimalFormatWithScale(format, symbols);
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {
logger.debug("Formatting failed for format {}, falling back", formatStr, iae); logger.log(POILogger.DEBUG, "Formatting failed for format " + formatStr + ", falling back", iae);
// the pattern could not be parsed correctly, // the pattern could not be parsed correctly,
// so fall back to the default number format // so fall back to the default number format
return getDefaultFormat(cellValue); return getDefaultFormat(cellValue);

View File

@ -8,6 +8,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import com.alibaba.easyexcel.test.core.large.LargeDataTest;
import com.alibaba.easyexcel.test.util.TestFileUtil; import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
@ -30,7 +31,7 @@ import org.slf4j.LoggerFactory;
public class TempLargeDataTest { public class TempLargeDataTest {
private static final Logger LOGGER = LoggerFactory.getLogger(TempLargeDataTest.class); private static final Logger LOGGER = LoggerFactory.getLogger(LargeDataTest.class);
private int i = 0; private int i = 0;
private static File fileFill07; private static File fileFill07;

View File

@ -1,40 +0,0 @@
package com.alibaba.easyexcel.test.temp.poi;
import java.io.IOException;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 测试poi
*
* @author Jiaju Zhuang
**/
public class PoiDateFormatTest {
private static final Logger LOGGER = LoggerFactory.getLogger(PoiDateFormatTest.class);
@Test
public void read() throws IOException {
String file
= "/Users/zhuangjiaju/IdeaProjects/easyexcel/easyexcel-test/src/test/resources/dataformat/dataformat.xlsx";
XSSFWorkbook xssfWorkbook = new XSSFWorkbook( file);
XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0);
LOGGER.info("一共行数:{}", xssfSheet.getLastRowNum());
XSSFRow row = xssfSheet.getRow(7);
XSSFCell cell = row.getCell(0);
LOGGER.info("dd{}", cell.getDateCellValue());
LOGGER.info("dd{}", cell.getNumericCellValue());
LOGGER.info("dd{}", DateUtil.isCellDateFormatted(cell));
}
}

View File

@ -8,7 +8,6 @@ import java.util.Map;
import com.alibaba.easyexcel.test.demo.read.CustomStringStringConverter; import com.alibaba.easyexcel.test.demo.read.CustomStringStringConverter;
import com.alibaba.easyexcel.test.util.TestFileUtil; import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.cglib.beans.BeanMap;
import com.alibaba.excel.util.BeanMapUtils; import com.alibaba.excel.util.BeanMapUtils;
import com.alibaba.excel.util.FileUtils; import com.alibaba.excel.util.FileUtils;
import com.alibaba.excel.util.ListUtils; import com.alibaba.excel.util.ListUtils;
@ -25,6 +24,7 @@ import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.cglib.beans.BeanMap;
@Slf4j @Slf4j
public class TempWriteTest { public class TempWriteTest {

View File

@ -1,11 +0,0 @@
字符串标题,日期标题,数字标题
字符串0,2020-01-01 01:01:00,1
字符串1,2020-01-02 01:01:00,2
字符串2,2020-01-03 01:01:00,3
字符串3,2020-01-04 01:01:00,4
字符串4,2020-01-05 01:01:00,5
字符串5,2020-01-06 01:01:00,6
字符串6,2020-01-07 01:01:00,7
字符串7,2020-01-08 01:01:00,8
字符串8,2020-01-09 01:01:00,9
字符串9,2020-01-10 01:01:00,10
1 字符串标题 日期标题 数字标题
2 字符串0 2020-01-01 01:01:00 1
3 字符串1 2020-01-02 01:01:00 2
4 字符串2 2020-01-03 01:01:00 3
5 字符串3 2020-01-04 01:01:00 4
6 字符串4 2020-01-05 01:01:00 5
7 字符串5 2020-01-06 01:01:00 6
8 字符串6 2020-01-07 01:01:00 7
9 字符串7 2020-01-08 01:01:00 8
10 字符串8 2020-01-09 01:01:00 9
11 字符串9 2020-01-10 01:01:00 10

78
pom.xml
View File

@ -20,7 +20,7 @@
<properties> <properties>
<revision>4.0.3</revision> <revision>3.3.4</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.8</jdk.version> <jdk.version>1.8</jdk.version>
<gpg.skip>true</gpg.skip> <gpg.skip>true</gpg.skip>
@ -90,47 +90,48 @@
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>easyexcel-support</artifactId> <artifactId>easyexcel-support</artifactId>
<version>3.3.4</version> <version>${revision}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.11.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId> <artifactId>poi</artifactId>
<version>5.2.5</version> <version>4.1.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
<version>5.2.5</version> <version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.9.11</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>org.apache.poi</groupId>
<artifactId>commons-io</artifactId> <artifactId>poi-ooxml-schemas</artifactId>
<version>2.16.1</version> <version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.8</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.7.36</version> <version>1.7.32</version>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.9.9</version>
</dependency> </dependency>
<!-- provided -->
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>1.18.32</version> <version>1.18.20</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -192,12 +193,12 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version> <version>2.22.2</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version> <version>3.2.4</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
@ -237,13 +238,11 @@
<exclude>com/alibaba/excel/metadata/DataFormatter.java</exclude> <exclude>com/alibaba/excel/metadata/DataFormatter.java</exclude>
<exclude>com/alibaba/excel/util/DateUtils.java</exclude> <exclude>com/alibaba/excel/util/DateUtils.java</exclude>
<exclude>com/alibaba/excel/util/MapUtils.java</exclude> <exclude>com/alibaba/excel/util/MapUtils.java</exclude>
<exclude>com/alibaba/excel/util/EasyExcelTempFileCreationStrategy.java</exclude>
<exclude>com/alibaba/excel/metadata/format/DataFormatter.java</exclude> <exclude>com/alibaba/excel/metadata/format/DataFormatter.java</exclude>
<exclude>com/alibaba/excel/metadata/format/ExcelGeneralNumberFormat.java</exclude> <exclude>com/alibaba/excel/metadata/format/ExcelGeneralNumberFormat.java</exclude>
<exclude>com/alibaba/excel/metadata/csv/CsvDataFormat.java</exclude> <exclude>com/alibaba/excel/metadata/csv/CsvDataFormat.java</exclude>
<exclude>com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java</exclude> <exclude>com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java</exclude>
<exclude>com/alibaba/excel/analysis/v07/handlers/sax/SharedStringsTableHandler.java</exclude> <exclude>com/alibaba/excel/analysis/v07/handlers/sax/SharedStringsTableHandler.java</exclude>
<exclude>com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java</exclude>
</excludes> </excludes>
</configuration> </configuration>
<executions> <executions>
@ -322,6 +321,31 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>${project.groupId}:${project.artifactId}</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.springframework</pattern>
<shadedPattern>com.alibaba.excel.support</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>

View File

@ -1,25 +1,3 @@
# 4.0.3
* 兼容部分日期格式读取异常的问题
# 4.0.2
* 兼容某些特殊的xls: 修改了内置的样式导致判断样式错误
* 重新加回 `commons-io`
# 4.0.1
* `commons-io` 修改为依赖 `poi`的版本
* 修复临时目录被清理可能提示`NoSuchFileException`的异常
# 4.0.0
* `poi`由`4.1.2`升级到`5.2.5`
* `commons-csv`由`1.1.0`升级到`1.10.0`
* `slf4j-api`由`1.7.32`升级到`1.7.36`
* `ehcache`由`3.9.9`升级到`3.9.11`
* 支持`jdk21`
# 3.3.4 # 3.3.4
* 支持停止单个`sheet`以后继续读取其他`sheet`,使用`ExcelAnalysisStopSheetException` * 支持停止单个`sheet`以后继续读取其他`sheet`,使用`ExcelAnalysisStopSheetException`