整合导出--页眉页脚

This commit is contained in:
zhn
2022-10-09 14:33:50 +08:00
parent 79236b57f9
commit af78fd1c2f
2 changed files with 15 additions and 8 deletions
@@ -884,8 +884,8 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
titleCN = "\r\n\r\n" + titleCN + "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
WordUtil.exportWord(document, titleCN, null, ParagraphAlignment.CENTER, 0, 18,
false, false, "Blue Sky Noto Regular",null,null,flag);
WordUtil.exportWord(document, moth+"\r\n", null, ParagraphAlignment.CENTER, 0, 12,
false, true, "Blue Sky Noto Regular",null,null,flag);
WordUtil.exportWord(document, moth, null, ParagraphAlignment.CENTER, 0, 12,
false, false, "Blue Sky Noto Regular",null,null,flag);
//添加下一页
document.createParagraph().createRun().addBreak(BreakType.PAGE);
}
@@ -900,8 +900,8 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
titleCN = "\r\n\r\n" + titleCN + "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
WordUtil.exportWord(document, titleCN, null, ParagraphAlignment.CENTER, 0, 18,
false, false, "Blue Sky Noto Regular",null,null,flag);
WordUtil.exportWord(document, moth+"\r\n", null, ParagraphAlignment.CENTER, 0, 12,
false, true, "Blue Sky Noto Regular",null,null,flag);
WordUtil.exportWord(document, moth, null, ParagraphAlignment.CENTER, 0, 12,
false, false, "Blue Sky Noto Regular",null,null,flag);
//添加下一页
document.createParagraph().createRun().addBreak(BreakType.PAGE);
}
@@ -266,12 +266,15 @@ public class WordUtil {
picture.getCTPicture().getBlipFill().getBlip().setEmbed(blipID);
run.addTab();
is.close();
run.setText(" "+month);
run.setFontSize(11);
run.setFontFamily("Blue Sky Noto Regular");
}
//页眉第二个段落展示日期------------------------------------------------------------
XWPFParagraph paragraph = header.createParagraph();//创建新的段落
paragraph.setAlignment(ParagraphAlignment.RIGHT);//段落文本的对齐方式
// paragraph.setAlignment(ParagraphAlignment.RIGHT);//段落文本的对齐方式
XWPFRun run = paragraph.createRun();
run.setText(month);
// run.setText(month);
//页脚(三个段落分别展示3个内容)-----------------------------------------------------
XWPFFooter footer = headerFooterPolicy.createFooter(XWPFHeaderFooterPolicy.DEFAULT);
@@ -280,11 +283,15 @@ public class WordUtil {
paragraph.setAlignment(ParagraphAlignment.CENTER);
run = paragraph.createRun();
run.setText("NIO Internal");
run.setFontSize(11);
run.setFontFamily("Blue Sky Standard Regular");
paragraph = footer.createParagraph();
paragraph.setAlignment(ParagraphAlignment.LEFT);
run = paragraph.createRun();
run.setText("NIO.com");
run.setFontSize(11);
run.setFontFamily("Blue Sky Noto Regular");
//生成页码---------------------------------------------------------------------
paragraph = footer.createParagraph();
@@ -317,8 +324,8 @@ public class WordUtil {
pageMar.setTop(BigInteger.valueOf(1440)); //页眉高度
pageMar.setBottom(BigInteger.valueOf(1440));//页脚高度
pageMar.setHeader(BigInteger.valueOf(500)); //页眉上边框到顶部的距离
pageMar.setFooter(BigInteger.valueOf(800)); //页脚下边框到底部的距离
pageMar.setHeader(BigInteger.valueOf(720)); //页眉上边框到顶部的距离
pageMar.setFooter(BigInteger.valueOf(720)); //页脚下边框到底部的距离
}
/**