Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-auth
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
base_platform_enterprise
gic-platform-auth
Commits
93ba9995
Commit
93ba9995
authored
Apr 08, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出添加2层标题结构方法
parent
41194dd1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
18 deletions
+22
-18
pom.xml
gic-platform-auth-web/pom.xml
+2
-2
CollaboratorController.java
...a/com/gic/auth/web/controller/CollaboratorController.java
+6
-2
ExcelUtils.java
...-web/src/main/java/com/gic/auth/web/utils/ExcelUtils.java
+14
-14
No files found.
gic-platform-auth-web/pom.xml
View file @
93ba9995
...
...
@@ -114,12 +114,12 @@
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
3.1
1
</version>
<version>
3.1
7
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
3.1
1
</version>
<version>
3.1
7
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/CollaboratorController.java
View file @
93ba9995
package
com
.
gic
.
auth
.
web
.
controller
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
javax.servlet.http.HttpServletRequest
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.download.qo.HeaderQO
;
import
com.gic.enterprise.context.RequestContext
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -89,10 +92,11 @@ public class CollaboratorController extends DownloadUtils{
return
result
.
getResult
().
getResult
();
}
};
String
[]
headers
=
new
String
[]
{
"协作人名称"
,
"手机号"
,
"创建时间"
};
List
<
HeaderQO
>
headerList
=
Stream
.
of
(
new
HeaderQO
(
"测试1"
,
Arrays
.
asList
(
"名称"
,
"时间"
,
"时间"
)),
new
HeaderQO
(
"测试2"
,
null
)).
collect
(
Collectors
.
toList
());
String
[]
fields
=
new
String
[]
{
"collaboratorName"
,
"phone"
,
"createTime"
};
try
{
download
(
path
,
reportId
,
fileName
,
excelExtensionCode
,
Arrays
.
asList
(
headers
)
,
Arrays
.
asList
(
fields
),
loader
,
Arrays
.
asList
(
"phone"
),
null
);
download
OfDoubleHeaderTitle
(
path
,
reportId
,
fileName
,
excelExtensionCode
,
headerList
,
Arrays
.
asList
(
fields
),
loader
,
Arrays
.
asList
(
"phone"
),
null
);
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
e
);
}
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/utils/ExcelUtils.java
View file @
93ba9995
...
...
@@ -169,7 +169,7 @@ public class ExcelUtils {
private
static
XSSFCellStyle
getTitleStyle
(
XSSFWorkbook
workbook
)
{
XSSFCellStyle
style
=
ExcelUtils
.
getColumnTopStyle
(
workbook
);
style
.
setFillForegroundColor
(
IndexedColors
.
LIGHT_GREEN
.
getIndex
());
style
.
setFillPattern
(
CellStyle
.
SOLID_FOREGROUND
);
//
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
return
style
;
}
...
...
@@ -183,25 +183,25 @@ public class ExcelUtils {
// 设置字体大小
font
.
setFontHeightInPoints
((
short
)
11
);
// 字体加粗
font
.
setBoldweight
(
XSSFFont
.
BOLDWEIGHT_BOLD
);
//
font.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);
// 设置字体名字
font
.
setFontName
(
"Courier New"
);
// 设置样式;
XSSFCellStyle
style
=
workbook
.
createCellStyle
();
// 设置底边框;
style
.
setBorderBottom
(
XSSFCellStyle
.
BORDER_THIN
);
//
style.setBorderBottom(XSSFCellStyle.BORDER_THIN);
// 设置底边框颜色;
// style.setBottomBorderColor(XSSFColor.BLACK.index);
// 设置左边框;
style
.
setBorderLeft
(
XSSFCellStyle
.
BORDER_THIN
);
//
style.setBorderLeft(XSSFCellStyle.BORDER_THIN);
// 设置左边框颜色;
// style.setLeftBorderColor(XSSFColor.BLACK.index);
// 设置右边框;
style
.
setBorderRight
(
XSSFCellStyle
.
BORDER_THIN
);
//
style.setBorderRight(XSSFCellStyle.BORDER_THIN);
// 设置右边框颜色;
// style.setRightBorderColor(XSSFColor.BLACK.index);
// 设置顶边框;
style
.
setBorderTop
(
XSSFCellStyle
.
BORDER_THIN
);
//
style.setBorderTop(XSSFCellStyle.BORDER_THIN);
// 设置顶边框颜色;
// style.setTopBorderColor(XSSFColor.BLACK.index);
// 在样式用应用设置的字体;
...
...
@@ -209,9 +209,9 @@ public class ExcelUtils {
// 设置自动换行;
style
.
setWrapText
(
false
);
// 设置水平对齐的样式为居中对齐;
style
.
setAlignment
(
XSSFCellStyle
.
ALIGN_CENTER
);
//
style.setAlignment(XSSFCellStyle.ALIGN_CENTER);
// 设置垂直对齐的样式为居中对齐;
style
.
setVerticalAlignment
(
XSSFCellStyle
.
VERTICAL_CENTER
);
//
style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
return
style
;
...
...
@@ -234,19 +234,19 @@ public class ExcelUtils {
// 设置样式;
XSSFCellStyle
style
=
workbook
.
createCellStyle
();
// 设置底边框;
style
.
setBorderBottom
(
XSSFCellStyle
.
BORDER_THIN
);
//
style.setBorderBottom(XSSFCellStyle.BORDER_THIN);
// 设置底边框颜色;
// style.setBottomBorderColor(XSSFColor.BLACK.index);
// 设置左边框;
style
.
setBorderLeft
(
XSSFCellStyle
.
BORDER_THIN
);
//
style.setBorderLeft(XSSFCellStyle.BORDER_THIN);
// 设置左边框颜色;
// style.setLeftBorderColor(XSSFColor.BLACK.index);
// 设置右边框;
style
.
setBorderRight
(
XSSFCellStyle
.
BORDER_THIN
);
//
style.setBorderRight(XSSFCellStyle.BORDER_THIN);
// 设置右边框颜色;
// style.setRightBorderColor(XSSFColor.BLACK.index);
// 设置顶边框;
style
.
setBorderTop
(
XSSFCellStyle
.
BORDER_THIN
);
//
style.setBorderTop(XSSFCellStyle.BORDER_THIN);
// 设置顶边框颜色;
// style.setTopBorderColor(XSSFColor.BLACK.index);
// 在样式用应用设置的字体;
...
...
@@ -254,9 +254,9 @@ public class ExcelUtils {
// 设置自动换行;
style
.
setWrapText
(
false
);
// 设置水平对齐的样式为居中对齐;
style
.
setAlignment
(
XSSFCellStyle
.
ALIGN_CENTER
);
//
style.setAlignment(XSSFCellStyle.ALIGN_CENTER);
// 设置垂直对齐的样式为居中对齐;
style
.
setVerticalAlignment
(
XSSFCellStyle
.
VERTICAL_CENTER
);
//
style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
return
style
;
}
...
...
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