Using java Syntax Highlighting
// Workaround for https://issues.apache.org/bugzilla/show ... i?id=54094
// You can comment this out if you are using FOP post 1.1
// (see pom.xml for tips on how to configure that)
Object o = wordMLPackage.getMainDocumentPart().getContent().get(0);
if (o instanceof P
&& ((P)o).getPPr()!=null) {
PPr pPr = ((P)o).getPPr();
BooleanDefaultTrue val = new BooleanDefaultTrue();
val.setVal(Boolean.FALSE);
pPr.setPageBreakBefore(val);
}
// You can comment this out if you are using FOP post 1.1
// (see pom.xml for tips on how to configure that)
Object o = wordMLPackage.getMainDocumentPart().getContent().get(0);
if (o instanceof P
&& ((P)o).getPPr()!=null) {
PPr pPr = ((P)o).getPPr();
BooleanDefaultTrue val = new BooleanDefaultTrue();
val.setVal(Boolean.FALSE);
pPr.setPageBreakBefore(val);
}
Parsed in 0.016 seconds, using GeSHi 1.0.8.4
As per https://issues.apache.org/bugzilla/show ... i?id=54094 the bug was fixed after the FOP 1.1 release. At the time of writing, FOP 1.1 is the current release.
docx4j 2.8.1 can't use any recent build of FOP, since the method for configuring FOP changed after 1.1. See wiki.apache.org/xmlgraphics-fop/FopFactoryConfiguration
Current docx4j tip on GitHub can use either FOP 1.0/1.1 or a later version.
You can get a snapshot of this version of docx4j, with appropriate dependencies, including FOP built from svn, at http://www.docx4java.org/docx4j/docx4j- ... Pr1468367/
The changes are:
- replace docx4j jar
- replace fop jar
- replace xmlgraphics-commons
- replace batik jar
If you are using pom.xml, add:
Using xml Syntax Highlighting
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.1</version>
</dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.1</version>
</dependency>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
and comment out:
Using xml Syntax Highlighting
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>xmlgraphics-commons</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
You'll also need to add the following classes to your class path:
http://svn.apache.org/viewvc/xmlgraphic ... ll-1.7.jar
http://svn.apache.org/viewvc/xmlgraphic ... -trunk.jar