Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
tianjin-cement
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
竹天卫
tianjin-cement
Commits
05500501
Commit
05500501
authored
Jan 14, 2021
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出下标 完成
parent
ba3488c5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
ExcelUtil.java
.../main/java/cn/wise/sc/cement/business/util/ExcelUtil.java
+7
-6
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/util/ExcelUtil.java
View file @
05500501
...
...
@@ -199,17 +199,18 @@ public class ExcelUtil {
}
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
// style.setWrapText(true); //关键
String
value
=
data
[
i
]
==
null
?
null
:
data
[
i
].
toString
();
cell
=
row
.
createCell
(
i
);
cell
.
setCellValue
(
data
[
i
]
==
null
?
null
:
data
[
i
].
toString
());
//处理下标
if
(
cell
.
getStringCellValue
().
contains
(
"<sub>"
)
||
cell
.
getStringCellValue
()
.
contains
(
"</sub>"
)
){
if
(
value
.
contains
(
"<sub>"
)
||
value
.
contains
(
"</sub>"
)
){
cell
.
setCellStyle
(
style
);
XSSFRichTextString
richString
=
new
XSSFRichTextString
(
cell
.
getStringCellValue
()
.
replaceAll
(
"</sub>"
,
"<sub>"
).
replaceAll
(
"<sub>"
,
""
));
XSSFRichTextString
richString
=
new
XSSFRichTextString
(
value
.
replaceAll
(
"</sub>"
,
"<sub>"
).
replaceAll
(
"<sub>"
,
""
));
//提取下标位置
applyRichStringFont
(
cell
.
getStringCellValue
()
,
richString
,
xxsfFont
);
applyRichStringFont
(
value
,
richString
,
xxsfFont
);
cell
.
setCellValue
(
richString
);
}
else
{
cell
.
setCellValue
(
value
);
cell
.
setCellStyle
(
style
);
}
...
...
@@ -232,7 +233,7 @@ public class ExcelUtil {
if
(
i
%
2
!=
0
)
{
it_str
=
it_str
+
split
[
i
-
1
];
}
else
{
richString
.
applyFont
(
it_str
.
length
(),(
it_str
+
split
[
i
-
1
]).
length
()
-
1
,
xxsfFont
);
richString
.
applyFont
(
it_str
.
length
(),(
it_str
+
split
[
i
-
1
]).
length
(),
xxsfFont
);
it_str
=
it_str
+
split
[
i
-
1
];
}
...
...
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