Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
Overview
Overview
Details
Activity
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
常超
map-parent
Commits
d65426c2
Commit
d65426c2
authored
Sep 26, 2023
by
yangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
西藏主题研判提交(西藏)
parent
7550fff1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
common/common_utils/src/main/java/com/founder/commonutils/util/ExportExcelUtil.java
+12
-5
No files found.
common/common_utils/src/main/java/com/founder/commonutils/util/ExportExcelUtil.java
View file @
d65426c2
...
...
@@ -40,19 +40,26 @@ public class ExportExcelUtil<T> {
value
++;
}
}
//创建Excel工作薄对象
HSSFWorkbook
wb
=
new
HSSFWorkbook
();
//创建Excel工作表对象
HSSFSheet
sheet
=
wb
.
createSheet
(
title
);
// 设置列宽
sheet
.
setDefaultColumnWidth
((
short
)
15
);
//
生成一个
样式
//
创建单元格
样式
HSSFCellStyle
style
=
wb
.
createCellStyle
();
//创建Excel工作表的行
HSSFRow
row
=
sheet
.
createRow
(
0
);
style
.
setAlignment
(
HSSFCellStyle
.
ALIGN_CENTER
);
System
.
out
.
println
(
HSSFWorkbook
.
class
.
getProtectionDomain
().
getCodeSource
().
getLocation
()
);
HSSFCell
cell
;
Collection
<
String
>
c
=
headersNameMap
.
values
();
// 拿到表格所有标题的value的集合
// 拿到表格所有标题的value的集合
Collection
<
String
>
c
=
headersNameMap
.
values
();
Iterator
<
String
>
it
=
c
.
iterator
();
// 表格标题的迭代器
// 根据选择的字段生成表头
shor
t
size
=
0
;
in
t
size
=
0
;
while
(
it
.
hasNext
())
{
System
.
out
.
println
(
it
);
String
s
=
it
.
toString
();
cell
=
row
.
createCell
(
size
);
cell
.
setCellValue
(
it
.
next
().
toString
());
cell
.
setCellStyle
(
style
);
...
...
@@ -107,7 +114,7 @@ public class ExportExcelUtil<T> {
}
else
{
textVal
=
null
;
}
row
.
createCell
(
(
short
)
zdCell
)
row
.
createCell
(
zdCell
)
.
setCellValue
(
textVal
);
zdCell
++;
}
catch
(
Exception
e
)
{
...
...
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