页眉添加期数

This commit is contained in:
zhn
2022-10-27 10:57:00 +08:00
parent e2385b900f
commit ddc97405cc
2 changed files with 10 additions and 3 deletions
@@ -1257,7 +1257,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
// WordUtil.exportHeardAndFoot(document,moth);
//生成页眉页脚
WordUtil.exportHeardAndFoot(document,moth);
WordUtil.exportHeardAndFoot(document,moth,cut);
//生成标题
// WordUtil.exportWord(document, "", null, ParagraphAlignment.CENTER, 0, 18,
// false, true, "Blue Sky Noto Regular",null,null,null);
@@ -208,7 +208,7 @@ public class WordUtil {
//主要内容生成页眉页脚(office版本)
@SneakyThrows
public static void exportHeardAndFoot(XWPFDocument document,String month){
public static void exportHeardAndFoot(XWPFDocument document,String month,String cut){
XWPFHeaderFooterPolicy headerFooterPolicy = document.getHeaderFooterPolicy();
if (headerFooterPolicy == null) headerFooterPolicy = document.createHeaderFooterPolicy();
XWPFHeader header = headerFooterPolicy.createHeader(XWPFHeaderFooterPolicy.DEFAULT);
@@ -232,7 +232,14 @@ public class WordUtil {
picture.getCTPicture().getBlipFill().getBlip().setEmbed(blipID);
run.addTab();
is.close();
run.setText(" "+month);
if(CutEnum.CN.getValue().equals(cut)){
run.setText(" "+month+" (总第 期)");
}else{
String replace = month.replace("", " ").replace("", "");
String monthTemp = replace.split(" ")[1]+"/"+replace.split(" ")[0];
run.setText(" "+monthTemp+" (Issue No. )");
}
run.setFontSize(11);
run.setFontFamily("Blue Sky Noto Regular");
}