Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
datax-cloud
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
黄营
datax-cloud
Commits
a19cf9d9
Commit
a19cf9d9
authored
Apr 22, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.0.0项目初始化
parent
ce3bd70b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
WordUtil.java
...ce/src/main/java/cn/datax/commo/office/word/WordUtil.java
+10
-9
No files found.
datax-common/datax-common-office/src/main/java/cn/datax/commo/office/word/WordUtil.java
View file @
a19cf9d9
...
@@ -127,14 +127,9 @@ public class WordUtil {
...
@@ -127,14 +127,9 @@ public class WordUtil {
* @param destPath 文件路径 F:\\test\\审批流提交.docx
* @param destPath 文件路径 F:\\test\\审批流提交.docx
* @return
* @return
*/
*/
public
boolean
newWord
(
String
destPath
)
{
public
void
createWord
(
String
destPath
)
throws
Exception
{
try
{
Document
doc
=
new
Document
();
Document
doc
=
new
Document
();
doc
.
save
(
destPath
,
SaveOptions
.
createSaveOptions
(
SaveFormat
.
DOCX
));
doc
.
save
(
destPath
,
SaveOptions
.
createSaveOptions
(
SaveFormat
.
DOCX
));
return
true
;
}
catch
(
Exception
e
)
{
return
false
;
}
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
...
@@ -154,7 +149,13 @@ public class WordUtil {
...
@@ -154,7 +149,13 @@ public class WordUtil {
map2
.
put
(
"sex"
,
"女"
);
map2
.
put
(
"sex"
,
"女"
);
map2
.
put
(
"salary"
,
new
BigDecimal
(
"7.34"
));
map2
.
put
(
"salary"
,
new
BigDecimal
(
"7.34"
));
list
.
add
(
map2
);
list
.
add
(
map2
);
WordUtil
.
getInstance
().
fillWordListData
(
new
String
[]{
"companyName"
,
"totalSalary"
},
new
Object
[]{
"测试"
,
new
BigDecimal
(
"12.34"
)},
"F:\\test\\模板.docx"
,
"F:\\test\\123.docx"
,
list
,
"workerList"
);
List
<
String
>
objects1
=
new
ArrayList
<>();
List
<
Object
>
objects2
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
map
.
entrySet
()){
objects1
.
add
(
entry
.
getKey
());
objects2
.
add
(
entry
.
getValue
());
}
WordUtil
.
getInstance
().
fillWordListData
(
objects1
.
toArray
(
new
String
[
objects1
.
size
()]),
objects2
.
toArray
(
new
Object
[
objects2
.
size
()]),
"F:\\test\\模板.docx"
,
"F:\\test\\123.docx"
,
list
,
"workerList"
);
// WordUtil.getInstance().word2pdf("F:\\test\\审批流提交.docx", "F:\\test\\20200420.pdf");
// WordUtil.getInstance().word2pdf("F:\\test\\审批流提交.docx", "F:\\test\\20200420.pdf");
}
}
}
}
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