Commit ea8fa0d1 by yuwei

项目初始化

parent 905c3571
...@@ -40,8 +40,8 @@ public class MergeDataSource { ...@@ -40,8 +40,8 @@ public class MergeDataSource {
public Document load(String[] name, Object[] value, String modelPath, List<Map<String, Object>> dataList, String tableName) throws Exception { public Document load(String[] name, Object[] value, String modelPath, List<Map<String, Object>> dataList, String tableName) throws Exception {
Document doc = new Document(modelPath); Document doc = new Document(modelPath);
MailMerge merge = doc.getMailMerge(); MailMerge merge = doc.getMailMerge();
doc.getMailMerge().executeWithRegions(new MapMailMergeDataSource(dataList, tableName));
merge.execute(name, value); merge.execute(name, value);
merge.executeWithRegions(new MapMailMergeDataSource(dataList, tableName));
return doc; return doc;
} }
} }
...@@ -50,16 +50,20 @@ public class WordUtil { ...@@ -50,16 +50,20 @@ public class WordUtil {
/** /**
* 获取文档 * 获取文档
* *
* @param fileName 模板文件 F:\模板.docx
* @return * @return
* @throws Exception
*/ */
public Document getDocument() throws Exception { public Document getDocument(String fileName) throws Exception {
return new Document(); return new Document(fileName);
} }
/** /**
* 获取文档 * 获取文档
* *
* @param inputStream 模板文件输入流
* @return * @return
* @throws Exception
*/ */
public Document getDocument(InputStream inputStream) throws Exception { public Document getDocument(InputStream inputStream) throws Exception {
return new Document(inputStream); return new Document(inputStream);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment