79358685

Date: 2025-01-15 15:04:04
Score: 1
Natty:
Report link

I was able to solve this by attaching the sectPr of the last section to the document instead of a paragraph.

    SectPr sectPr = factory.createSectPr();
    SectPr.Type sectPrType = factory.createSectPrType();
    sectPrType.setVal("nextPage");

    sectPr.setType(sectPrType);

    wordprocessingMLPackage.getMainDocumentPart().getJaxbElement().getBody().setSectPr(sectPr);
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Gopika Ravikumar