Skip to content

docx template containing a table generates java.lang.NullPointerException #175

@distributev

Description

@distributev

Using the attached docx template

template-col0col1-table.docx

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions