mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
ExcelReader.getWriter逻辑变更,当从非文件读取时,获取sheet,而非空表格。
This commit is contained in:
parent
45ed3a95f9
commit
16fc04d955
@ -428,13 +428,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