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
e2c8107b
Commit
e2c8107b
authored
Feb 28, 2023
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EXCEL自定义列处理
parent
cfd43d84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
ExcelConsole.java
...-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
+8
-8
ExportColumn.java
...-db/src/main/java/com/yanzuoguang/excel/ExportColumn.java
+1
-1
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
View file @
e2c8107b
...
...
@@ -187,7 +187,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
String
[]
columns
=
new
String
[
this
.
config
.
getColumns
().
size
()];
int
pos
=
0
;
for
(
ExportColumn
column
:
this
.
config
.
getColumns
())
{
column
.
column
=
pos
;
column
.
column
Index
=
pos
;
columns
[
pos
++]
=
column
.
getTitle
();
}
return
TableHeadHelper
.
getTableHead
(
columns
);
...
...
@@ -282,7 +282,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
// 设置列宽度
// 合并数据配置
for
(
ExportColumn
column
:
this
.
config
.
getColumns
())
{
sheet
.
setColumnWidth
(
column
.
column
,
getUnit
(
column
.
getWidth
()));
sheet
.
setColumnWidth
(
column
.
column
Index
,
getUnit
(
column
.
getWidth
()));
// 列样式
column
.
cellStyle
=
createColumnStyle
(
this
.
workbook
,
column
);
}
...
...
@@ -318,10 +318,10 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
// 设置列别名
for
(
ExportColumn
column
:
this
.
config
.
getColumns
())
{
map
.
put
(
column
.
getName
(),
String
.
format
(
"%s:%s"
,
CellReferenceUtil
.
getCoordName
(
column
.
column
,
this
.
startDataRowIndex
),
CellReferenceUtil
.
getCoordName
(
column
.
column
,
this
.
endDataRowIndex
)
CellReferenceUtil
.
getCoordName
(
column
.
column
Index
,
this
.
startDataRowIndex
),
CellReferenceUtil
.
getCoordName
(
column
.
column
Index
,
this
.
endDataRowIndex
)
));
map
.
put
(
column
.
getName
()
+
"_COL"
,
CellReferenceUtil
.
getColName
(
column
.
column
));
map
.
put
(
column
.
getName
()
+
"_COL"
,
CellReferenceUtil
.
getColName
(
column
.
column
Index
));
}
// 数据行开始行号
map
.
put
(
"startDataRowIndex"
,
CellReferenceUtil
.
getRowName
(
this
.
startDataRowIndex
));
...
...
@@ -400,9 +400,9 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
// 当前行行高
height
=
Math
.
max
(
nowCellHeight
,
height
);
// 当不需要合并历史记录时,则创建新的内容
createCell
(
row
,
column
.
column
,
value
,
column
.
cellStyle
);
createCell
(
row
,
column
.
column
Index
,
value
,
column
.
cellStyle
);
// 合并列
mergerColumn
(
column
,
column
.
column
,
false
);
mergerColumn
(
column
,
column
.
column
Index
,
false
);
}
row
.
setHeight
((
short
)
Math
.
min
(
height
,
Short
.
MAX_VALUE
));
...
...
@@ -484,7 +484,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
// 合并数据配置
if
(
this
.
rowData
>
0
)
{
for
(
ExportColumn
column
:
this
.
config
.
getColumns
())
{
mergerColumn
(
column
,
column
.
column
,
true
);
mergerColumn
(
column
,
column
.
column
Index
,
true
);
}
}
...
...
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExportColumn.java
View file @
e2c8107b
...
...
@@ -47,7 +47,7 @@ public class ExportColumn {
/**
* 列序号
*/
int
column
;
int
column
Index
;
/**
* 合计列数据
*/
...
...
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