Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
f5231ade
Commit
f5231ade
authored
Sep 12, 2023
by
jinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
群发记录导出
parent
4062b871
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
8 deletions
+29
-8
pom.xml
haoban-manage3-web/pom.xml
+2
-2
ExcelSheet.java
...rc/main/java/com/gic/haoban/manage/web/qo/ExcelSheet.java
+24
-3
ExportSheetUtil.java
...java/com/gic/haoban/manage/web/utils/ExportSheetUtil.java
+3
-3
No files found.
haoban-manage3-web/pom.xml
View file @
f5231ade
...
...
@@ -95,7 +95,7 @@
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
5.2.2
</version>
<version>
3.9
</version>
<exclusions>
<exclusion>
<groupId>
commons-codec
</groupId>
...
...
@@ -106,7 +106,7 @@
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
5.2.2
</version>
<version>
3.9
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/ExcelSheet.java
View file @
f5231ade
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
;
import
lombok.Data
;
import
java.util.List
;
/**
...
...
@@ -9,7 +7,6 @@ import java.util.List;
* @Author: wenhua
* @Date: 2023/9/12 11:19
*/
@Data
public
class
ExcelSheet
{
/*** sheet的名称*/
private
String
fileName
;
...
...
@@ -20,6 +17,30 @@ public class ExcelSheet {
/*** sheet里的数据集*/
private
List
<
String
[]>
dataset
;
public
String
getFileName
()
{
return
fileName
;
}
public
void
setFileName
(
String
fileName
)
{
this
.
fileName
=
fileName
;
}
public
String
[]
getHanders
()
{
return
handers
;
}
public
void
setHanders
(
String
[]
handers
)
{
this
.
handers
=
handers
;
}
public
List
<
String
[]>
getDataset
()
{
return
dataset
;
}
public
void
setDataset
(
List
<
String
[]>
dataset
)
{
this
.
dataset
=
dataset
;
}
public
ExcelSheet
(
String
fileName
,
String
[]
handers
,
List
<
String
[]>
dataset
)
{
this
.
fileName
=
fileName
;
this
.
handers
=
handers
;
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/utils/ExportSheetUtil.java
View file @
f5231ade
...
...
@@ -2,6 +2,7 @@ package com.gic.haoban.manage.web.utils;
import
com.gic.haoban.manage.web.qo.ExcelSheet
;
import
org.apache.poi.hssf.usermodel.*
;
import
org.apache.poi.ss.usermodel.CellStyle
;
import
org.apache.poi.ss.usermodel.HorizontalAlignment
;
import
org.apache.poi.ss.usermodel.VerticalAlignment
;
import
org.springframework.http.MediaType
;
...
...
@@ -25,9 +26,9 @@ public class ExportSheetUtil {
//表头样式
HSSFCellStyle
style
=
wb
.
createCellStyle
();
// 垂直
style
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
style
.
setVerticalAlignment
(
CellStyle
.
ALIGN_
CENTER
);
// 水平
style
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
style
.
setAlignment
(
CellStyle
.
VERTICAL_
CENTER
);
//字体样式
HSSFFont
fontStyle
=
wb
.
createFont
();
fontStyle
.
setFontName
(
"微软雅黑"
);
...
...
@@ -73,7 +74,6 @@ public class ExportSheetUtil {
response
.
setHeader
(
"Cache-Control"
,
"No-cache"
);
response
.
flushBuffer
();
wb
.
write
(
response
.
getOutputStream
());
wb
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
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