All,
I have very strange scenario in that I have Java Spring Boot application which uses docx4j to read in a docx template, modify the content, and save the result as a docx file. When I start up the application, the first time I generate a document it works correctly. However, if the attempt to generate another one, the resulting document is corrupted, primarily by dropping text boxes and graphic images in the template.
As an experiment, I just loaded the document and then saved it, with no edits in between. The resulting document was different from the original in the same way.
Architecturally, the class is instantiated each run and its reference is set to null at the end. I have to be getting a new object each time so I don't believe it is old data from the previous document corrupting the generation of the second one.
I've tried increasing the memory of the JVM but that doesn't seem to help. The logs, the voluminous logs, don't seem to show a problem but I'm really not sure what I'm looking for.
Any ideas on this mystery would be greatly appreciated!
Wade
wordMLPackage = WordprocessingMLPackage.load(file);
documentPart = wordMLPackage.getMainDocumentPart();
.
.
.
<change content>
.
.
wordMLPackage.save(new File(reportFolder + name + ".docx"));