docx template containing a table generates java.lang.NullPointerException
distributev opened this issue · comments
Using the attached docx template
which contains a basic table
I get
Caused by: org.docx4j.openpackaging.exceptions.Docx4JException: Exception exporting package
at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:106)
at org.docx4j.Docx4J.toFO(Docx4J.java:712)
at org.docx4j.Docx4J.toPDF(Docx4J.java:741)
at com.haulmont.yarg.formatters.impl.DocxFormatter.saveAndClose(DocxFormatter.java:151)
... 29 more
Caused by: java.lang.NullPointerException: Cannot invoke "org.docx4j.wml.Style.getPPr()" because "expressStyle" is null
at org.docx4j.convert.out.common.preprocess.ParagraphStylesInTableFix$StyleRenamer.getCellPStyle(ParagraphStylesInTableFix.java:250)
at org.docx4j.convert.out.common.preprocess.ParagraphStylesInTableFix$StyleRenamer.apply(ParagraphStylesInTableFix.java:585)
at org.docx4j.convert.out.common.preprocess.ParagraphStylesInTableFix$StyleRenamer.walkJAXBElements(ParagraphStylesInTableFix.java:625)
Environment
yarg 2.2.14
- Operating system:
Windows 10
Description of the bug or enhancement
- Minimal reproducible example
Map<String, Object> variablesData = new HashMap<String, Object>();
variablesData.put("col0", "data0");
variablesData.put("col1", "data1");
final String TEMPLATE_DOCX_WORDPAD_PATH = "src/test/resources/input/external-libraries/template-col0col1-table.docx";
String outputFilePath = TestsUtils.TESTS_OUTPUT_FOLDER + "/YargTest/generatePDFTemplateDocxTable/output.pdf";
generateDocument(outputFilePath, TEMPLATE_DOCX_WORDPAD_PATH, variablesData);