Closed hubStarzy closed 2 years ago
我找到原因了,可能是我的这个word文档格式有点儿问题,导致doRender的时候
HtmlRenderContext htmlRenderContext = new HtmlRenderContext(context);
CTPageMar pgMar = sectPr.getPgMar(); long top = POIXMLUnits.parseLength(pgMar.xgetTop());
方法init的时候获取页面样式的时候导致null 新建了一个word文档再次执行就好了。
老哥,帮忙看一下我这个是什么原因
主要代码
pom文件
报错信息 13:16:43.728 [main] INFO com.deepoove.poi.render.processor.ElementProcessor - Start render Template {{bigTitle}}, Sign:�, policy:TextRenderPolicy 13:16:43.731 [main] INFO com.deepoove.poi.render.processor.ElementProcessor - Start render Template {{smallTitle}}, Sign:�, policy:TextRenderPolicy 13:16:43.732 [main] INFO com.deepoove.poi.render.processor.ElementProcessor - Start render Template {{tableBigTitle}}, Sign:�, policy:TextRenderPolicy 13:16:43.732 [main] INFO com.deepoove.poi.render.processor.ElementProcessor - Start render Template {{key}}, Sign:�, policy:HtmlRenderPolicy Exception in thread "main" com.deepoove.poi.exception.RenderException: Unable to render template {{key}} at com.deepoove.poi.policy.AbstractRenderPolicy.reThrowException(AbstractRenderPolicy.java:83) at com.deepoove.poi.policy.AbstractRenderPolicy.render(AbstractRenderPolicy.java:65) at com.deepoove.poi.render.processor.ElementProcessor.visit(ElementProcessor.java:76) at com.deepoove.poi.render.processor.ElementProcessor.visit(ElementProcessor.java:67) at com.deepoove.poi.template.run.RunTemplate.accept(RunTemplate.java:64) at com.deepoove.poi.render.processor.DocumentProcessor.visit(DocumentProcessor.java:95) at com.deepoove.poi.template.run.RunTemplate.accept(RunTemplate.java:64) at com.deepoove.poi.render.processor.DocumentProcessor.lambda$process$0(DocumentProcessor.java:59) at java.util.ArrayList.forEach(ArrayList.java:1259) at com.deepoove.poi.render.processor.DocumentProcessor.process(DocumentProcessor.java:59) at com.deepoove.poi.render.DefaultRender.renderTemplate(DefaultRender.java:82) at com.deepoove.poi.render.DefaultRender.render(DefaultRender.java:64) at com.deepoove.poi.XWPFTemplate.render(XWPFTemplate.java:209) at com.scan.common.util.wordDomo.main(wordDomo.java:26) Caused by: java.lang.NullPointerException at org.ddr.poi.html.HtmlRenderContext.(HtmlRenderContext.java:194)
at org.ddr.poi.html.HtmlRenderPolicy.doRender(HtmlRenderPolicy.java:156)
at com.deepoove.poi.policy.AbstractRenderPolicy.render(AbstractRenderPolicy.java:62)
... 12 more