mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
ExcelReader.getWriter逻辑变更,当从非文件读取时,获取sheet,而非空表格。
This commit is contained in:
parent
97bf3c0acc
commit
c70aa5a8e8
@ -2,10 +2,11 @@
|
|||||||
# 🚀Changelog
|
# 🚀Changelog
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.21(2023-06-25)
|
# 5.8.21(2023-06-26)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【core 】 list 为空时,CollUtil.max等返回null而非异常(pr#1027@Gitee)
|
* 【core 】 list 为空时,CollUtil.max等返回null而非异常(pr#1027@Gitee)
|
||||||
|
* 【poi 】 ExcelReader.getWriter逻辑变更,当从非文件读取时,获取sheet,而非空表格。
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【core 】 修复MapUtil工具使用filter方法构造传入参数结果问题(issue#3162@Github)
|
* 【core 】 修复MapUtil工具使用filter方法构造传入参数结果问题(issue#3162@Github)
|
||||||
|
@ -416,13 +416,20 @@ public class ExcelReader extends ExcelBase<ExcelReader> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取Excel写出器<br>
|
* 获取Excel写出器<br>
|
||||||
* 在读取Excel并做一定编辑后,获取写出器写出<br>
|
* 在读取Excel并做一定编辑后,获取写出器写出,规则如下:
|
||||||
* 注意,只读方式下,此方法无效
|
* <ul>
|
||||||
|
* <li>1. 当从流中读取时,转换为Writer直接使用Sheet对象,此时修改不会影响源文件,Writer中flush需要指定新的路径。</li>
|
||||||
|
* <li>2. 当从文件读取时,直接获取文件及sheet名称,此时可以修改原文件。</li>
|
||||||
|
* </ul>
|
||||||
*
|
*
|
||||||
* @return {@link ExcelWriter}
|
* @return {@link ExcelWriter}
|
||||||
* @since 4.0.6
|
* @since 4.0.6
|
||||||
*/
|
*/
|
||||||
public ExcelWriter getWriter() {
|
public ExcelWriter getWriter() {
|
||||||
|
if(null == this.destFile){
|
||||||
|
// 非读取文件形式,直接获取sheet操作。
|
||||||
|
return new ExcelWriter(this.sheet);
|
||||||
|
}
|
||||||
return ExcelUtil.getWriter(this.destFile, this.sheet.getSheetName());
|
return ExcelUtil.getWriter(this.destFile, this.sheet.getSheetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user