I want to create two headers and two footers in a word document, for example in the attached word file.
I tried for a long time but not found a solution.
Can someone kindly give me some help (some code better), thanks a lot!
It is currently Sat Nov 29, 2025 7:59 pm
News of PlutextWordprocessingMLPackage wordprocessingMLPackage = WordprocessingMLPackage.load(new File("c:\\document.docx"));
System.out.println(XmlUtils.marshaltoString(wordprocessingMLPackage.getMainDocumentPart().getJaxbElement(), true, true));
INFO [org.docx4j.utils.XPathFactoryUtil:22] - xpath implementation: org.apache.xpath.jaxp.XPathFactoryImpl
INFO [org.docx4j.openpackaging.io3.Load3:180] - package read; elapsed time: 4635 ms
INFO [org.docx4j.openpackaging.parts.JaxbXmlPart:129] - Lazily unmarshalling /word/document.xml
INFO [org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware:299] - For org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart, unmarshall via binder
java.lang.NumberFormatException: For input string: "10206.0"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:458)
at java.math.BigInteger.<init>(BigInteger.java:316)
at java.math.BigInteger.<init>(BigInteger.java:451)
at com.sun.xml.bind.DatatypeConverterImpl._parseInteger(DatatypeConverterImpl.java:88)
Total posts 10213 • Total topics 2877 • Total members 2103