1 先找到word模板,用${},替换变量,保存,然后另存为xml,最后把xml后缀改成ftl。 如下图: word 模板文件 ftl模板文件如下: 2 代码生成 下面函数将ftl填充数据,并生成word和pdf public static String ftl2word2pdf(Map<String, Object> dataMap, String templateName, int format) { if (!getLicense()) { return null; } FileOutputStream os = null; try { String path="C:\\Users\\Administrator\\Desktop\\asposeTest\\"; File directory = new File(path); String absolutePath = directory.getAbsolutePath(); Configuration configuration = new Configuration(new Version("2.3.0"));...