Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
48d8d5d6
Commit
48d8d5d6
authored
Jan 20, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口文档的支持
parent
c8438535
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
20 deletions
+15
-20
ExcelConsole.java
...-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
+15
-20
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
View file @
48d8d5d6
...
@@ -281,7 +281,6 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
...
@@ -281,7 +281,6 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
Row
row
=
sheet
.
createRow
(
rowIndex
);
Row
row
=
sheet
.
createRow
(
rowIndex
);
row
.
setHeight
(
getUnit
(
this
.
config
.
getRowHeight
()));
row
.
setHeight
(
getUnit
(
this
.
config
.
getRowHeight
()));
// 合并組数据处理
// 合并組数据处理
for
(
Map
.
Entry
<
String
,
List
<
String
>>
groupKvp
:
mergerGroup
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
String
>>
groupKvp
:
mergerGroup
.
entrySet
())
{
// 将当前組生成值密钥
// 将当前組生成值密钥
...
@@ -292,7 +291,6 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
...
@@ -292,7 +291,6 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
sb
.
append
(
":"
);
sb
.
append
(
":"
);
}
}
String
groupValue
=
StringHelper
.
md5
(
sb
.
toString
());
String
groupValue
=
StringHelper
.
md5
(
sb
.
toString
());
// 更新合并内容
// 更新合并内容
ExcelMergerData
mergerData
=
mergerGroupData
.
get
(
groupKvp
.
getKey
());
ExcelMergerData
mergerData
=
mergerGroupData
.
get
(
groupKvp
.
getKey
());
mergerData
.
updateMerger
(
rowIndex
,
groupValue
);
mergerData
.
updateMerger
(
rowIndex
,
groupValue
);
...
@@ -306,20 +304,24 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
...
@@ -306,20 +304,24 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
// 当不需要合并历史记录时,则创建新的内容
// 当不需要合并历史记录时,则创建新的内容
Cell
cell
=
createCell
(
row
,
columnPos
,
value
,
true
);
Cell
cell
=
createCell
(
row
,
columnPos
,
value
,
true
);
// 判断列是否需要合并
mergerColumn
(
column
,
columnPos
,
false
);
if
(
column
.
isMerger
())
{
ExcelMergerData
mergerData
=
mergerGroupData
.
get
(
column
.
getMegerGroup
());
// 判断是否需要合并历史记录
if
(
mergerData
.
isMergerFlag
())
{
// 合并历史记录单元格
mergerData
(
mergerData
,
columnPos
);
}
}
}
}
rowIndex
++;
rowIndex
++;
}
}
private
void
mergerColumn
(
ExportColumn
column
,
int
columnPos
,
boolean
last
)
{
// 判断列是否需要合并
if
(
column
.
isMerger
())
{
ExcelMergerData
mergerData
=
mergerGroupData
.
get
(
column
.
getMegerGroup
());
// 判断是否需要合并历史记录
if
(
mergerData
.
isMergerFlag
()
||
last
)
{
// 合并历史记录单元格
mergerData
(
mergerData
,
columnPos
);
}
}
}
/**
/**
* 合并数据
* 合并数据
*
*
...
@@ -346,15 +348,8 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
...
@@ -346,15 +348,8 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
// 合并数据配置
// 合并数据配置
for
(
int
columnPos
=
0
;
columnPos
<
this
.
config
.
getColumns
().
size
();
columnPos
++)
{
for
(
int
columnPos
=
0
;
columnPos
<
this
.
config
.
getColumns
().
size
();
columnPos
++)
{
ExportColumn
column
=
this
.
config
.
getColumns
().
get
(
columnPos
);
ExportColumn
column
=
this
.
config
.
getColumns
().
get
(
columnPos
);
// 判断列是否需要合并
mergerColumn
(
column
,
columnPos
,
true
);
if
(
column
.
isMerger
())
{
ExcelMergerData
mergerData
=
mergerGroupData
.
get
(
column
.
getMegerGroup
());
// 判断是否需要合并历史记录
if
(
mergerData
.
isMergerFlag
())
{
// 合并历史记录单元格
mergerData
(
mergerData
,
columnPos
);
}
}
if
(
column
.
getWidth
()
<
1
)
{
if
(
column
.
getWidth
()
<
1
)
{
//设置单元格长度, 这里要乘上256
//设置单元格长度, 这里要乘上256
int
maxBytes
=
columnBytes
.
get
(
columnPos
);
int
maxBytes
=
columnBytes
.
get
(
columnPos
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment