Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
b75fd821
Commit
b75fd821
authored
Sep 08, 2025
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(amos-boot-module-jg-biz): 修复 Word 模板中的控制字符问题
- 在 convertContent 方法中添加 removeControlCharsManual 函数调用 - 新增 removeControlCharsManual 方法,手动移除控制字符 - 保留了换行符、回车符和制表符
parent
0dd3e344
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
WordTemplateUtils.java
...join/amos/boot/module/jg/biz/utils/WordTemplateUtils.java
+15
-0
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/utils/WordTemplateUtils.java
View file @
b75fd821
...
@@ -287,6 +287,7 @@ public class WordTemplateUtils {
...
@@ -287,6 +287,7 @@ public class WordTemplateUtils {
if
(
value
==
null
)
{
if
(
value
==
null
)
{
return
null
;
return
null
;
}
}
value
=
removeControlCharsManual
(
value
);
return
value
.
replace
(
"&"
,
"&"
)
return
value
.
replace
(
"&"
,
"&"
)
.
replace
(
"<"
,
"<"
)
.
replace
(
"<"
,
"<"
)
.
replace
(
">"
,
">"
)
.
replace
(
">"
,
">"
)
...
@@ -296,4 +297,18 @@ public class WordTemplateUtils {
...
@@ -296,4 +297,18 @@ public class WordTemplateUtils {
.
replace
(
")"
,
")"
);
.
replace
(
")"
,
")"
);
}
}
public
static
String
removeControlCharsManual
(
String
input
)
{
if
(
input
==
null
)
return
""
;
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
input
.
length
();
i
++)
{
char
c
=
input
.
charAt
(
i
);
// 只保留允许的字符
if
(
c
>
31
||
c
==
'\t'
||
c
==
'\n'
||
c
==
'\r'
)
{
sb
.
append
(
c
);
}
}
return
sb
.
toString
();
}
}
}
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