当前位置:网站首页>Freemark uses FTL files to generate word
Freemark uses FTL files to generate word
2022-06-23 16:51:00 【softwareDragon】
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.23</version>
</dependency>
import freemarker.template.TemplateException;
import java.io.*;
import java.util.Map;
import freemarker.template.Configuration;
import freemarker.template.Template;
public class AA {
//dataMap For the data model ftlName by bb In this directory ftl file
public static byte[] createDocForFtl(Map<String, Object> dataMap,String ftlName)
throws IOException {
Configuration configuration = new Configuration();
configuration.setDefaultEncoding("utf-8");
// The package path where the template needs to be exported
configuration.setClassForTemplateLoading(AA.class, "/bb");
Template t = null;
try {
t = configuration.getTemplate(ftlName);
} catch (IOException e) {
e.printStackTrace();
}
Writer out = new StringWriter();
// Merge the template and data model into a file
try {
// Generate the file
t.process(dataMap, out);
return out.toString().getBytes();
} catch (TemplateException e) {
e.printStackTrace();
} finally {
if (out != null) {
out.close();
}
}
return null;
}
}边栏推荐
- JS common error reporting and exception capture
- R language uses the image of magick package_ The scale function resizes the image. You can customize the scaling from the angle of width or height
- 六石编程学:运用之妙,存乎一心
- golang gob实现网络数据的传输
- 2022九峰小学(光谷第二十一小学)生源摸底
- Six stone programming: the subtlety of application
- Importance and purpose of test
- Reading and writing JSON files by golang
- 出现Identify and stop the process that‘s listening on port 8080 or configure this application等解决方法
- OutputDebugString instructions and exception handling
猜你喜欢

多年亿级流量下的高并发经验总结,都毫无保留地写在了这本书中

Asemi ultrafast recovery diode es1j parameters, es1j package, es1j specification

Jetpack compose and material you FAQs

使用Jmeter进行性能测试及性能监控平台搭建

Importance and purpose of test

Shushulang passed the listing hearing: the gross profit margin of the tablet business fell, and the profit in 2021 fell by 11% year-on-year

stylegan1: a style-based henerator architecture for gemerative adversarial networks

安全舒适,全新一代奇骏用心诠释老父亲的爱

Network remote access raspberry pie (VNC viewer)

Server deployment and instructions
随机推荐
Solution: in the verification phase, the first batch does not report errors, and the second batch reports CUDA exceeded errors
Can the asemi fast recovery diodes RS1M, us1m and US1G be replaced with each other
读书郎通过上市聆讯:平板业务毛利率走低,2021年利润同比下滑11%
ADC数字地DGND、模拟地AGND的谜团!
ASEMI肖特基二极管和超快恢复二极管在开关电源中的对比
leetcode:面試題 08.13. 堆箱子【自頂而下的dfs + memory or 自底而上的排序 + dp】
stylegan1: a style-based henerator architecture for gemerative adversarial networks
Matlab: how to know from some data which data are added to get a known number
数字经济加速落地,能为中小企业带来什么?
TensorRT Paser加载onnx 推理使用
Tupu software builds smart city with lightweight modeling
What are the inductance parameters? How to choose inductance?
How long does it take to open a stock account by mobile phone? Is online account opening safe?
图扑数字孪生 3D 风电场,智慧风电之海上风电
电感参数有哪些?怎么选择电感?
R语言使用colorblinr包模拟色盲视觉、将已有的ggplot2可视化结果图像使用edit_colors函数编辑转化为色盲视觉友好的可视化结果、并自定设置色盲形式、色盲严重级别
如何选择券商?手机开户安全么?
安全舒适,全新一代奇骏用心诠释老父亲的爱
Shushulang passed the listing hearing: the gross profit margin of the tablet business fell, and the profit in 2021 fell by 11% year-on-year
测试的重要性及目的