废话不多说,直接上代码
@Test
public void testWordFX() throws IOException, InvalidFormatException, Exception{
//以下代码不一定要用,可以通过其他方法打开自己项目里面的模板 from this
InputStream inputStream = ClassPathResource.class.getResourceAsStream("/file/任免表.docx");
InputStream inputConf = ClassPathResource.class.getResourceAsStream("/file/任免表.json");
JSONObject conf = JSON.parseObject(IOUtils.toString(inputConf, "utf-8"));
AppointDismissBean result = new AppointDismissBean();
List<LeaderFamilyBean> listContent = result.getLeaderFamilyList();
List<Object> list = new ArrayList<Object>();
List<List<Object>> loops = new ArrayList<List<Object>>();
loops.add(list);
Word07Template word07Template = new Word07Template();
XWPFDocument doc = word07Te