Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_879456671
easyexcel
提交
234fc2d5
E
easyexcel
项目概览
qq_879456671
/
easyexcel
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
easyexcel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
234fc2d5
编写于
9月 17, 2021
作者:
庄家钜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改填充可以不自动继承样式 [Issue #1710]
上级
8c95bfca
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
32 addition
and
58 deletion
+32
-58
src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java
.../alibaba/excel/write/executor/ExcelWriteFillExecutor.java
+11
-7
src/main/java/com/alibaba/excel/write/metadata/fill/FillConfig.java
...ava/com/alibaba/excel/write/metadata/fill/FillConfig.java
+19
-49
src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
+1
-2
update.md
update.md
+1
-0
未找到文件。
src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java
浏览文件 @
234fc2d5
...
...
@@ -84,7 +84,7 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
data
=
new
HashMap
<
String
,
Object
>(
16
);
}
if
(
fillConfig
==
null
)
{
fillConfig
=
FillConfig
.
builder
().
build
(
true
);
fillConfig
=
FillConfig
.
builder
().
build
();
}
fillConfig
.
init
();
...
...
@@ -301,11 +301,13 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
if
(
isOriginalCell
)
{
collectionFieldStyleMap
.
put
(
analysisCell
,
cell
.
getCellStyle
());
}
else
{
if
(
fillConfig
.
getAutoStyle
())
{
CellStyle
cellStyle
=
collectionFieldStyleMap
.
get
(
analysisCell
);
if
(
cellStyle
!=
null
)
{
cell
.
setCellStyle
(
cellStyle
);
}
}
}
return
cell
;
}
...
...
@@ -359,11 +361,13 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
collectionRowHeightCache
.
put
(
currentUniqueDataFlag
,
row
.
getHeight
());
return
;
}
if
(
fillConfig
.
getAutoStyle
())
{
Short
rowHeight
=
collectionRowHeightCache
.
get
(
currentUniqueDataFlag
);
if
(
rowHeight
!=
null
)
{
row
.
setHeight
(
rowHeight
);
}
}
}
private
List
<
AnalysisCell
>
readTemplateData
(
Map
<
String
,
List
<
AnalysisCell
>>
analysisCache
)
{
List
<
AnalysisCell
>
analysisCellList
=
analysisCache
.
get
(
currentUniqueDataFlag
);
...
...
src/main/java/com/alibaba/excel/write/metadata/fill/FillConfig.java
浏览文件 @
234fc2d5
...
...
@@ -2,11 +2,20 @@ package com.alibaba.excel.write.metadata.fill;
import
com.alibaba.excel.enums.WriteDirectionEnum
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* Fill config
*
* @author Jiaju Zhuang
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
FillConfig
{
private
WriteDirectionEnum
direction
;
/**
...
...
@@ -16,23 +25,15 @@ public class FillConfig {
* say the whole file will be stored in memory.
*/
private
Boolean
forceNewRow
;
private
boolean
hasInit
;
public
WriteDirectionEnum
getDirection
()
{
return
direction
;
}
public
void
setDirection
(
WriteDirectionEnum
direction
)
{
this
.
direction
=
direction
;
}
public
Boolean
getForceNewRow
()
{
return
forceNewRow
;
}
/**
* Automatically inherit style
*
* default true.
*/
private
Boolean
autoStyle
;
public
void
setForceNewRow
(
Boolean
forceNewRow
)
{
this
.
forceNewRow
=
forceNewRow
;
}
private
boolean
hasInit
;
public
void
init
()
{
if
(
hasInit
)
{
...
...
@@ -44,40 +45,9 @@ public class FillConfig {
if
(
forceNewRow
==
null
)
{
forceNewRow
=
Boolean
.
FALSE
;
}
hasInit
=
true
;
}
public
static
FillConfigBuilder
builder
()
{
return
new
FillConfigBuilder
();
if
(
autoStyle
==
null
)
{
autoStyle
=
Boolean
.
TRUE
;
}
public
static
class
FillConfigBuilder
{
private
FillConfig
fillConfig
;
FillConfigBuilder
()
{
this
.
fillConfig
=
new
FillConfig
();
}
public
FillConfigBuilder
direction
(
WriteDirectionEnum
direction
)
{
fillConfig
.
setDirection
(
direction
);
return
this
;
}
public
FillConfigBuilder
forceNewRow
(
Boolean
forceNewRow
)
{
fillConfig
.
setForceNewRow
(
forceNewRow
);
return
this
;
}
public
FillConfig
build
()
{
return
build
(
true
);
}
public
FillConfig
build
(
boolean
autoInit
)
{
if
(
autoInit
)
{
fillConfig
.
init
();
}
return
fillConfig
;
}
hasInit
=
true
;
}
}
src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
浏览文件 @
234fc2d5
...
...
@@ -32,12 +32,11 @@ public class Lock2Test {
@Test
public
void
test
()
throws
Exception
{
assert
1
!=
1
;
// File file = TestFileUtil.readUserHomeFile("test/test4.xlsx");
// File file = TestFileUtil.readUserHomeFile("test/test6.xls");
File
file
=
new
File
(
"/Users/zhuangjiaju/IdeaProjects/easyexcel/src/test/resources/converter/converter07.xlsx"
);
List
<
Object
>
list
=
EasyExcel
.
read
(
"/Users/zhuangjiaju/Downloads/
olay (1
).xlsx"
).
sheet
(
0
).
doReadSync
();
List
<
Object
>
list
=
EasyExcel
.
read
(
"/Users/zhuangjiaju/Downloads/
1 (2
).xlsx"
).
sheet
(
0
).
doReadSync
();
LOGGER
.
info
(
"数据:{}"
,
list
.
size
());
for
(
Object
data
:
list
)
{
LOGGER
.
info
(
"返回数据:{}"
,
CollectionUtils
.
size
(
data
));
...
...
update.md
浏览文件 @
234fc2d5
...
...
@@ -28,6 +28,7 @@
*
修复头和数据对象不一致会覆盖的问题
[
Issue #1870
](
https://github.com/alibaba/easyexcel/issues/1870
)
*
修复忽略字段后可能排序不一致的问题
*
修改填充时,无法使用生成的模板
[
Issue #1552
](
https://github.com/alibaba/easyexcel/issues/1552
)
*
修改填充可以不自动继承样式
[
Issue #1710
](
https://github.com/alibaba/easyexcel/issues/1710
)
# 2.2.11
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录