1、参考了文章Java之利用FreeMarker导出Word实例_rentian1的博客-CSDN博客
2、引入freemarker-2.3.13包
3、此方法生成docx是有问题的,docx文件打开报错
4、前台:window.location.href="/system/download?id="+data;
@RequestMapping(value = "/downloadApply")
public ResponseEntity<byte[]> downloadApply(String id) throws Exception {
/** 初始化配置文件 **/
Configuration configuration = new Configuration();
/** 设置编码 **/
configuration.setDefaultEncoding("utf-8");
//读取tomcat下的模板
String serverPath = Thread.currentThread().getContextClassLoader().getResource("").toString();
serverPath="/"+serverPath;
// 将/换成\
serverPath = serverPath.replace("/", File.separator);
// 去掉file:
serverPath = serverPath.replace("f