Document doc = new Document();
Section section = doc.addSection();
Paragraph paragraph = section.getHeadersFooters().getFooter().addParagraph();
// 需要根据您的文本宽度进行手动调整
paragraph.appendText("left\t\t\t\t\t\t");
paragraph.appendField("页码", FieldType.Field_Page);
paragraph.appendText("\t\t\t\t\t\tright");
paragraph.getFormat().setHorizontalAlignment(HorizontalAlignment.Center);
doc.saveToFile("test.docx", FileFormat.Docx_2013);