Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
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
liyang
sts网站
Commits
7b9060af
Commit
7b9060af
authored
Jun 19, 2025
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化Excel统计行数值的单元格样式显示
parent
1a2f20e8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
ExcelUtil.java
...n/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
+2
-6
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
View file @
7b9060af
...
@@ -186,11 +186,6 @@ public class ExcelUtil<T>
...
@@ -186,11 +186,6 @@ public class ExcelUtil<T>
*/
*/
private
Map
<
Integer
,
Double
>
statistics
=
new
HashMap
<
Integer
,
Double
>();
private
Map
<
Integer
,
Double
>
statistics
=
new
HashMap
<
Integer
,
Double
>();
/**
* 数字格式
*/
private
static
final
DecimalFormat
DOUBLE_FORMAT
=
new
DecimalFormat
(
"######0.00"
);
/**
/**
* 实体对象
* 实体对象
*/
*/
...
@@ -861,6 +856,7 @@ public class ExcelUtil<T>
...
@@ -861,6 +856,7 @@ public class ExcelUtil<T>
style
=
wb
.
createCellStyle
();
style
=
wb
.
createCellStyle
();
style
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
style
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
style
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
style
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
style
.
setDataFormat
(
dataFormat
.
getFormat
(
"######0.00"
));
Font
totalFont
=
wb
.
createFont
();
Font
totalFont
=
wb
.
createFont
();
totalFont
.
setFontName
(
"Arial"
);
totalFont
.
setFontName
(
"Arial"
);
totalFont
.
setFontHeightInPoints
((
short
)
10
);
totalFont
.
setFontHeightInPoints
((
short
)
10
);
...
@@ -1442,7 +1438,7 @@ public class ExcelUtil<T>
...
@@ -1442,7 +1438,7 @@ public class ExcelUtil<T>
{
{
cell
=
row
.
createCell
(
key
);
cell
=
row
.
createCell
(
key
);
cell
.
setCellStyle
(
styles
.
get
(
"total"
));
cell
.
setCellStyle
(
styles
.
get
(
"total"
));
cell
.
setCellValue
(
DOUBLE_FORMAT
.
format
(
statistics
.
get
(
key
)
));
cell
.
setCellValue
(
statistics
.
get
(
key
));
}
}
statistics
.
clear
();
statistics
.
clear
();
}
}
...
...
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