If an OpenOffice ODT is loaded with user fields that have modified styles, saving it back to ODT loses the modified styles. They revert to the base style.
In the attached .zip there are 4 documents:
- UserFieldStyleTest4.odt - the original document
- UserFieldStyleTest4-merged.odt - the merged document, saved to ODT. This demonstrates loss of styling. [1]
- UserFieldStyleTest4-merged.pdf - the merged document, saved to PDF. This looks correct. [2]
- UserFieldStyleTest4-merged2.pdf - generated from UserFieldStyleTest4-merged.odt. This demonstrates loss of styling [3]
The following code was used:
Document document = new Document("UserFieldStyleTest4.odt");
document.getVariables().add("field", "Test Value 1");
document.updateFields();
document.save("UserFieldStyleTest4-merged.odt"); // [1] loss of style information
document.save("UserFieldStyleTest4-merged.pdf"); // [2] this looks OK
Document converter = new Document("UserFieldStyleTest4-merged.odt");
converter.updateFields();
converter.save("UserFieldStyleTest4-merged2.pdf"); // [3] loss of style information
Given that that PDF at [2] is correct but incorrect at [3], it is the export at [1] to ODT that is causing the issues.
UserFieldStyleTest4.zip (82.1 KB)