org.freemarker
freemarker
2.3.32
doc格式转docx格式所需要的依赖
com.luhuiguo
aspose-words
22.4
pom
拷贝到idea中,错位自行修改
今天星期:<#if week??>${week}<#else >周一#if>
天气:<#if weather??>${weather}<#else >null#if>
心情:<#if mood??>${mood}<#else >null#if>
姓名
性别
年龄
循环表格
<#list list![] as val>
<#if val.name??>${val.name}<#else >null#if>
<#if val.sex??>${val.sex}<#else >null#if>
<#if val.age??>${val.age}<#else >null#if>
#list>
import com.aspose.words.SaveFormat;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.Version;
import org.junit.Test;
import com.aspose.words.Document;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class GenWord {
@Test
public void gen() throws Exception {
Map map = new HashMap<>();
map.put("week", "周一");
map.put("weather", "雨夹雪");
map.put("mood", "开心");
List
今天星期:<#if week??>${week}<#else >周一#if>
天气:<#if weather??>${weather}<#else >null#if>
心情:<#if mood??>${mood}<#else >null#if>
姓名
性别
年龄
<#list list![] as val>
<#if val.name??>${val.name}<#else >null#if>
<#if val.sex??>${val.sex}<#else >null#if>
<#if val.age??>${val.age}<#else >null#if>
#list>
猛超 张
猛超 张
2
2023-12-04T13:35:00Z
2023-12-04T13:35:00Z
Normal.dotm
3
1
10
62
Microsoft Office Word
0
1
1
false
false
71
false
false
16.0000