"fo:block-container" is missing child when converting docx
Posted: Fri Apr 21, 2017 10:35 pm
Hi,
using docx4j 3.3.1 and docx4j-export-fo 3.3.0,
when I try to convert a docx (see attached file) to a pdf using
I get :
I tried to deactivate strict validation with the FOSettings but I still get the same exception...
I'm struggling to find a solution, If someone can give me a hand...
Thanks !
Jeremy.
using docx4j 3.3.1 and docx4j-export-fo 3.3.0,
when I try to convert a docx (see attached file) to a pdf using
- Code: Select all
Docx4J.toFO(foSettings, dest, Docx4J.FLAG_EXPORT_PREFER_XSL);
I get :
- Code: Select all
org.docx4j.openpackaging.exceptions.Docx4JException: Exception writing Document to OutputStream: org.apache.fop.fo.ValidationException: "fo:block-container" is missing child elements. Required content model: marker* (%block;)+ (See position 1:6270)
at org.docx4j.utils.XmlSerializerUtil.serialize(XmlSerializerUtil.java:50)
at org.docx4j.utils.XmlSerializerUtil.serialize(XmlSerializerUtil.java:14)
at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:209)
at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:159)
at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:168)
at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:47)
at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:82)
at org.docx4j.Docx4J.toFO(Docx4J.java:568)
I tried to deactivate strict validation with the FOSettings but I still get the same exception...
- Code: Select all
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(source);
FOSettings foSettings = Docx4J.createFOSettings();
foSettings.setWmlPackage(wordMLPackage);
foSettings.setApacheFopConfiguration("<fop version=\"2.1\"><strict-validation>false</strict-validation></fop>");
I'm struggling to find a solution, If someone can give me a hand...
Thanks !
Jeremy.