Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thanks for your request. You can try using the following code.
//Open document document
Document doc = new Document("6883464.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
while (doc.getSections().get(1) != null)
{
//Move cursor to last paragraph of the first section
builder.moveTo(doc.getFirstSection().getBody().getLastParagraph());
//Insert Page break
builder.insertBreak(BreakType.PAGE_BREAK);
//Append content of the second section
doc.getFirstSection().appendContent(doc.getSections().get(1));
// Remove second section
doc.getSections().get(1).remove();
}
//Save output document
doc.save("out.doc");
I hope this could help you.
Best regards.