Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
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
徐少华
midjourney-proxy
Commits
302789f6
Commit
302789f6
authored
Jan 28, 2019
by
gaopeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
word生成加方法
parent
20cbb88d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
WordDataExportor.java
...com/pcloud/common/utils/export/word/WordDataExportor.java
+41
-0
No files found.
pcloud-common/src/main/java/com/pcloud/common/utils/export/word/WordDataExportor.java
View file @
302789f6
...
@@ -127,6 +127,47 @@ public class WordDataExportor {
...
@@ -127,6 +127,47 @@ public class WordDataExportor {
}
}
/**
/**
* 生成word
* @param dataMap
* @param templateName
* @return
* @author linweibin
* @date 2017年5月22日 下午5:22:38
*/
@SuppressWarnings
(
"deprecation"
)
public
static
void
generateWord
(
Class
clazz
,
Map
<
String
,
Object
>
dataMap
,
String
templateName
,
File
tmpdir
,
String
fileName
)
{
logger
.
info
(
"开始生成word+++"
);
try
{
// 创建配置实例
Configuration
configuration
=
new
Configuration
();
// 设置编码
configuration
.
setDefaultEncoding
(
"UTF-8"
);
// 获取template文件路径
configuration
.
setClassForTemplateLoading
(
clazz
,
"/template"
);
// 获取模板
Template
template
=
configuration
.
getTemplate
(
templateName
);
// 输出文件
File
outFile
=
new
File
(
tmpdir
,
fileName
);
// 将模板和数据模型合并生成文件
Writer
out
=
new
BufferedWriter
(
new
OutputStreamWriter
(
new
FileOutputStream
(
outFile
),
"UTF-8"
));
// 生成文件
template
.
process
(
dataMap
,
out
);
logger
.
info
(
"生成word+++成功"
);
// 关闭流
out
.
flush
();
out
.
close
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"生成word异常+++"
+
e
.
getMessage
(),
e
);
}
}
/**
* 生成随机文件名
* 生成随机文件名
* @return
* @return
* @author linweibin
* @author linweibin
...
...
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