Spring boot Freemarker 获取ContextPath的两种方法: 1.自定义viewResolver,Spring boot中有一个viewResolver,这个和配置文件中的师徒解析器是一样的,但是spring boot不允许xml配置文件,所以可以写一个自定义的FreeMarker视图解析器. public class MvcConfig extends WebMvcConfigurerAdapter { @Bean public FreeMarkerViewResolv…
思路解说 word 模板文件(doc 或 docx 文件)另存为 xml 文件 将后缀 xml 改成 html:大部分文档会改成 ftl(FreeMarker 的后缀名),因为 word 文件另存为 xml 文件后,xml 文件中的代码很乱,后面的修改会很麻烦,因为我习惯用 VSCode 编辑器,安装 Beautify 插件后,可以自动格式化 html 代码,这样有利于后面的修改 将内容用${param}替换:例:姓名:月牙坠-->姓名:${name} word 文件中的图片是 Base64 编…