Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
distributev opened this issue Jan 19, 2023 · 0 comments

Comments

@distributev
Copy link

distributev commented Jan 19, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant