plutext / docx4j

JAXB-based Java library for Word docx, Powerpoint pptx, and Excel xlsx files

Home Page:https://www.docx4java.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some settings are not taken into account (image directory)

toki07 opened this issue · comments

commented

When redefining the image directory path, some images are still in the default directory.

WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new File("/some/docxfile.docx"));
FOSettings foSettings = new FOSettings(wordMLPackage);
foSettings.setImageDirPath("/custom_temporary_directory");
foSettings.setApacheFopMime(FOSettings.INTERNAL_FO_MIME);

ByteArrayOutputStream os = new ByteArrayOutputStream();
Docx4J.toFO(foSettings, os, Docx4J.FLAG_EXPORT_PREFER_XSL);

This is caused by FOPAreaTreeHelper.java :

Document getAreaTreeViaFOP(WordprocessingMLPackage hfPkg, boolean useXSLT, FOSettings foSettingsOverall) throws Docx4JException, ParserConfigurationException, SAXException, IOException  {

FOSettings foSettingsHere = Docx4J.createFOSettings();
foSettingsHere.setFopConfig(foSettingsOverall.getFopConfig());

foSettingsHere use only some of the redefined settings from foSettingsOverall. And thus use the default directory for image generation.