Closed qyw10456 closed 2 years ago
大佬您好 HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy(); Configure configure = Configure.builder().bind("context", htmlRenderPolicy).build(); Map<String, Object> hashMap = new HashMap<>(); hashMap.put("context", safeTrain.getTrainContext()); XWPFTemplate template = XWPFTemplate.compile(FileUtils.getInputStream(URL),configure).render(hashMap); 发现并没有渲染标签,这是我用的版本 不知道哪里有问题,求大佬指教
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy(); Configure configure = Configure.builder().bind("context", htmlRenderPolicy).build(); Map<String, Object> hashMap = new HashMap<>(); hashMap.put("context", safeTrain.getTrainContext()); XWPFTemplate template = XWPFTemplate.compile(FileUtils.getInputStream(URL),configure).render(hashMap);
请先检查html内容是否正确,poi-tl的版本用1.10.3试试
hashMap.put("context","
Hello world!
这里put的值里有标签,被自动装换了,我直接复制的你示例里的值
大佬您好
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy(); Configure configure = Configure.builder().bind("context", htmlRenderPolicy).build(); Map<String, Object> hashMap = new HashMap<>(); hashMap.put("context", safeTrain.getTrainContext()); XWPFTemplate template = XWPFTemplate.compile(FileUtils.getInputStream(URL),configure).render(hashMap);
发现并没有渲染标签,这是我用的版本 不知道哪里有问题,求大佬指教