I have another (maybe) Java 9 specific error.
I have a DOCX file with a table, and there are tokens inside the table. (1 row, 3 cols -> 3 token)
I can replace the tokens with strings from code, which works very well.
I have the following code:
- Code: Select all
ByteArrayOutputStream pdfStream = new ByteArrayOutputStream();
ByteArrayOutputStream docxStream = new ByteArrayOutputStream();
try {
Docx4J.toPDF(wordMLPackage, pdfStream);
Docx4J.save(wordMLPackage, docxStream);
pdfStream.flush();
docxStream.flush();
pdfStream.close();
docxStream.close();
} catch (Docx4JException | IOException e) {
throw new IOException("Error when generating byte array from document!", e);
}
If I save the docxStream to a file, it contains the table, but the pdf is empty.
(The pdf contains the same table with Java 8 compiled code.)
So I think it's a Java 9 problem, and maybe I'm missing something in my dependencies.
My dependency tree looks like this:
- Code: Select all
dependencies {
implementation('commons-io:commons-io:2.6')
implementation('javax.xml.bind:jaxb-api:2.4.0-b180830.0359')
implementation('org.docx4j:docx4j:6.0.1')
implementation('org.docx4j:docx4j-export-fo:6.0.1')
implementation('org.docx4j:docx4j-ImportXHTML:6.0.1')
implementation('org.glassfish.jaxb:jaxb-core:2.3.0.1')
implementation('org.glassfish.jaxb:jaxb-runtime:2.3.0.1')
testImplementation('junit:junit:4.12')
}