Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Laubin729
easyexcel
提交
89781200
E
easyexcel
项目概览
Laubin729
/
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,发现更多精彩内容 >>
提交
89781200
编写于
6月 09, 2020
作者:
庄家钜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
跳转代码逻辑
上级
5c794ec6
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
44 addition
and
28 deletion
+44
-28
pom.xml
pom.xml
+2
-0
src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java
.../alibaba/excel/write/executor/ExcelWriteFillExecutor.java
+42
-28
未找到文件。
pom.xml
浏览文件 @
89781200
...
@@ -162,6 +162,8 @@
...
@@ -162,6 +162,8 @@
<exclude>
com/alibaba/excel/event/AnalysisEventListener.java
</exclude>
<exclude>
com/alibaba/excel/event/AnalysisEventListener.java
</exclude>
<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/metadata/format/DataFormatter.java
</exclude>
<exclude>
com/alibaba/excel/metadata/format/ExcelGeneralNumberFormat.java
</exclude>
</excludes>
</excludes>
</configuration>
</configuration>
<executions>
<executions>
...
...
src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java
浏览文件 @
89781200
...
@@ -295,8 +295,43 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
...
@@ -295,8 +295,43 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
default
:
default
:
throw
new
ExcelGenerateException
(
"The wrong direction."
);
throw
new
ExcelGenerateException
(
"The wrong direction."
);
}
}
Row
row
=
createRowIfNecessary
(
sheet
,
cachedSheet
,
lastRowIndex
,
fillConfig
,
analysisCell
,
isOriginalCell
);
Cell
cell
=
createCellIfNecessary
(
row
,
lastColumnIndex
);
Map
<
AnalysisCell
,
CellStyle
>
collectionFieldStyleMap
=
collectionFieldStyleCache
.
get
(
currentUniqueDataFlag
);
if
(
collectionFieldStyleMap
==
null
)
{
collectionFieldStyleMap
=
new
HashMap
<
AnalysisCell
,
CellStyle
>(
16
);
collectionFieldStyleCache
.
put
(
currentUniqueDataFlag
,
collectionFieldStyleMap
);
}
if
(
isOriginalCell
)
{
collectionFieldStyleMap
.
put
(
analysisCell
,
cell
.
getCellStyle
());
}
else
{
CellStyle
cellStyle
=
collectionFieldStyleMap
.
get
(
analysisCell
);
if
(
cellStyle
!=
null
)
{
cell
.
setCellStyle
(
cellStyle
);
}
}
return
cell
;
}
private
Cell
createCellIfNecessary
(
Row
row
,
Integer
lastColumnIndex
)
{
Cell
cell
=
row
.
getCell
(
lastColumnIndex
);
if
(
cell
!=
null
)
{
return
cell
;
}
WriteHandlerUtils
.
beforeCellCreate
(
writeContext
,
row
,
null
,
lastColumnIndex
,
null
,
Boolean
.
FALSE
);
cell
=
row
.
createCell
(
lastColumnIndex
);
WriteHandlerUtils
.
afterCellCreate
(
writeContext
,
cell
,
null
,
null
,
Boolean
.
FALSE
);
return
cell
;
}
private
Row
createRowIfNecessary
(
Sheet
sheet
,
Sheet
cachedSheet
,
Integer
lastRowIndex
,
FillConfig
fillConfig
,
AnalysisCell
analysisCell
,
boolean
isOriginalCell
)
{
Row
row
=
sheet
.
getRow
(
lastRowIndex
);
Row
row
=
sheet
.
getRow
(
lastRowIndex
);
if
(
row
==
null
)
{
if
(
row
!=
null
)
{
return
row
;
}
row
=
cachedSheet
.
getRow
(
lastRowIndex
);
row
=
cachedSheet
.
getRow
(
lastRowIndex
);
if
(
row
==
null
)
{
if
(
row
==
null
)
{
WriteHandlerUtils
.
beforeRowCreate
(
writeContext
,
lastRowIndex
,
null
,
Boolean
.
FALSE
);
WriteHandlerUtils
.
beforeRowCreate
(
writeContext
,
lastRowIndex
,
null
,
Boolean
.
FALSE
);
...
@@ -305,9 +340,9 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
...
@@ -305,9 +340,9 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
}
else
{
}
else
{
// The last row of the middle disk inside empty rows, resulting in cachedSheet can not get inside.
// The last row of the middle disk inside empty rows, resulting in cachedSheet can not get inside.
// Will throw Attempting to write a row[" + rownum + "] " + "in the range [0," + this._sh.getLastRowNum() + "] that is already written to disk.
// Will throw Attempting to write a row[" + rownum + "] " + "in the range [0," + this._sh.getLastRowNum() + "] that is already written to disk.
try
{
try
{
row
=
sheet
.
createRow
(
lastRowIndex
);
row
=
sheet
.
createRow
(
lastRowIndex
);
}
catch
(
IllegalArgumentException
ignore
)
{
}
catch
(
IllegalArgumentException
ignore
)
{
row
=
cachedSheet
.
createRow
(
lastRowIndex
);
row
=
cachedSheet
.
createRow
(
lastRowIndex
);
}
}
}
}
...
@@ -316,28 +351,7 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
...
@@ -316,28 +351,7 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
}
else
{
}
else
{
checkRowHeight
(
analysisCell
,
fillConfig
,
isOriginalCell
,
row
);
checkRowHeight
(
analysisCell
,
fillConfig
,
isOriginalCell
,
row
);
}
}
}
return
row
;
Cell
cell
=
row
.
getCell
(
lastColumnIndex
);
if
(
cell
==
null
)
{
WriteHandlerUtils
.
beforeCellCreate
(
writeContext
,
row
,
null
,
lastColumnIndex
,
null
,
Boolean
.
FALSE
);
cell
=
row
.
createCell
(
lastColumnIndex
);
WriteHandlerUtils
.
afterCellCreate
(
writeContext
,
cell
,
null
,
null
,
Boolean
.
FALSE
);
}
Map
<
AnalysisCell
,
CellStyle
>
collectionFieldStyleMap
=
collectionFieldStyleCache
.
get
(
currentUniqueDataFlag
);
if
(
collectionFieldStyleMap
==
null
)
{
collectionFieldStyleMap
=
new
HashMap
<
AnalysisCell
,
CellStyle
>(
16
);
collectionFieldStyleCache
.
put
(
currentUniqueDataFlag
,
collectionFieldStyleMap
);
}
if
(
isOriginalCell
)
{
collectionFieldStyleMap
.
put
(
analysisCell
,
cell
.
getCellStyle
());
}
else
{
CellStyle
cellStyle
=
collectionFieldStyleMap
.
get
(
analysisCell
);
if
(
cellStyle
!=
null
)
{
cell
.
setCellStyle
(
cellStyle
);
}
}
return
cell
;
}
}
private
void
checkRowHeight
(
AnalysisCell
analysisCell
,
FillConfig
fillConfig
,
boolean
isOriginalCell
,
Row
row
)
{
private
void
checkRowHeight
(
AnalysisCell
analysisCell
,
FillConfig
fillConfig
,
boolean
isOriginalCell
,
Row
row
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录