月报整合导出--页面大小及表格宽度
This commit is contained in:
+7
-8
@@ -779,7 +779,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
||||
}
|
||||
if(StringUtils.isNotBlank(twoTitle)){
|
||||
WordUtil.exportWord(document, twoNumber+" "+twoTitle, null, ParagraphAlignment.LEFT,
|
||||
2, 12, false, true, "Blue Sky Noto Regular","1","二级标题");
|
||||
0, 12, false, true, "Blue Sky Noto Regular","1","二级标题");
|
||||
twoCount++;
|
||||
}
|
||||
|
||||
@@ -793,7 +793,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
||||
}
|
||||
if(org.apache.commons.lang3.StringUtils.isNotBlank(reportTitle)){
|
||||
WordUtil.exportWord(document, reportCount+". "+reportTitle, null, ParagraphAlignment.LEFT,
|
||||
6, 12, false, false, "Blue Sky Noto Regular","2","三级标题");
|
||||
0, 12, false, false, "Blue Sky Noto Regular","2","三级标题");
|
||||
reportCount++;
|
||||
}
|
||||
}
|
||||
@@ -849,7 +849,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
||||
}
|
||||
if(StringUtils.isNotBlank(twoTitle)){
|
||||
WordUtil.exportWord(document, twoNumber+" "+twoTitle, null, ParagraphAlignment.LEFT,
|
||||
2, 12, false, true, "Blue Sky Noto Regular",null,null);
|
||||
0, 12, false, true, "Blue Sky Noto Regular",null,null);
|
||||
twoCount++;
|
||||
}
|
||||
|
||||
@@ -863,7 +863,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
||||
}
|
||||
if(org.apache.commons.lang3.StringUtils.isNotBlank(reportTitle)){
|
||||
WordUtil.exportWord(document, reportCount+". "+reportTitle, null, ParagraphAlignment.LEFT,
|
||||
6, 12, false, false, "Blue Sky Noto Regular",null,null);
|
||||
0, 12, false, false, "Blue Sky Noto Regular",null,null);
|
||||
reportCount++;
|
||||
}
|
||||
}
|
||||
@@ -877,7 +877,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
||||
XWPFDocument document) {
|
||||
String moth = lawsMonthlyReportWriteEOS.get(0).getMonth().replaceAll("-", "年") + "月";
|
||||
|
||||
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";
|
||||
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);
|
||||
WordUtil.exportWord(document, moth, null, ParagraphAlignment.CENTER, 0, 12,
|
||||
@@ -903,7 +903,6 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
||||
WordUtil.exportHeardAndFoot(document,moth);
|
||||
//生成标题
|
||||
WordUtil.exportWord(document, "", null, ParagraphAlignment.CENTER, 0, 18,
|
||||
// WordUtil.exportWord(document, "\r\n\r\n\r\n", null, ParagraphAlignment.CENTER, 0, 18,
|
||||
false, true, "Blue Sky Noto Regular",null,null);
|
||||
int oneCount = 1;
|
||||
|
||||
@@ -942,7 +941,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
||||
}
|
||||
if(StringUtils.isNotBlank(twoTitle)){
|
||||
WordUtil.exportWord(document, twoNumber+" "+twoTitle, null, ParagraphAlignment.LEFT,
|
||||
2, 12, false, true, "Blue Sky Noto Regular","1","二级标题");
|
||||
0, 12, false, true, "Blue Sky Noto Regular","1","二级标题");
|
||||
twoCount++;
|
||||
}
|
||||
//二级目录下放--->新征求意见清单模板, 新发布标准清单模板
|
||||
@@ -970,7 +969,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
||||
}
|
||||
if(StringUtils.isNotBlank(reportTitle)){
|
||||
WordUtil.exportWord(document, reportCount+". "+reportTitle, null, ParagraphAlignment.LEFT,
|
||||
6, 11, false, false, "Blue Sky Noto Regular","2","三级标题");
|
||||
0, 11, false, false, "Blue Sky Noto Regular","2","三级标题");
|
||||
}
|
||||
|
||||
|
||||
|
||||
+41
-32
@@ -32,6 +32,7 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTJc;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPageMar;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPageSz;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSectPr;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyle;
|
||||
@@ -277,10 +278,14 @@ public class WordUtil {
|
||||
|
||||
CTSectPr sectPr = document.getDocument().getBody().getSectPr();
|
||||
if (sectPr == null) sectPr = document.getDocument().getBody().addNewSectPr();
|
||||
//设置页面大小
|
||||
CTPageSz pgSz = sectPr.addNewPgSz();
|
||||
pgSz.setW(BigInteger.valueOf(11907));
|
||||
pgSz.setH(BigInteger.valueOf(16840));
|
||||
CTPageMar pageMar = sectPr.getPgMar();
|
||||
if (pageMar == null) pageMar = sectPr.addNewPgMar();
|
||||
pageMar.setLeft(BigInteger.valueOf(1000)); //左边距
|
||||
pageMar.setRight(BigInteger.valueOf(1000));//右边距
|
||||
pageMar.setLeft(BigInteger.valueOf(1803)); //左边距
|
||||
pageMar.setRight(BigInteger.valueOf(1803));//右边距
|
||||
pageMar.setTop(BigInteger.valueOf(1440)); //页眉高度
|
||||
pageMar.setBottom(BigInteger.valueOf(1440));//页脚高度
|
||||
|
||||
@@ -314,10 +319,14 @@ public class WordUtil {
|
||||
|
||||
CTSectPr sectPr = document.getDocument().getBody().getSectPr();
|
||||
if (sectPr == null) sectPr = document.getDocument().getBody().addNewSectPr();
|
||||
//设置页面大小
|
||||
CTPageSz pgSz = sectPr.addNewPgSz();
|
||||
pgSz.setW(BigInteger.valueOf(11907));
|
||||
pgSz.setH(BigInteger.valueOf(16840));
|
||||
CTPageMar pageMar = sectPr.getPgMar();
|
||||
if (pageMar == null) pageMar = sectPr.addNewPgMar();
|
||||
pageMar.setLeft(BigInteger.valueOf(1000)); //左边距
|
||||
pageMar.setRight(BigInteger.valueOf(1000));//右边距
|
||||
pageMar.setLeft(BigInteger.valueOf(1803)); //左边距
|
||||
pageMar.setRight(BigInteger.valueOf(1803));//右边距
|
||||
pageMar.setTop(BigInteger.valueOf(1440)); //页眉高度
|
||||
pageMar.setBottom(BigInteger.valueOf(1440));//页脚高度
|
||||
|
||||
@@ -469,12 +478,12 @@ public class WordUtil {
|
||||
//表格宽度
|
||||
CTJc cTJc = tablePr.addNewJc();
|
||||
//居中
|
||||
cTJc.setVal(STJc.CENTER);
|
||||
cTJc.setVal(STJc.LEFT);
|
||||
//列宽自动分割
|
||||
CTTblWidth tableWidth = tablePr.addNewTblW();
|
||||
//设置表格宽度
|
||||
tableWidth.setType(STTblWidth.DXA);
|
||||
tableWidth.setW(BigInteger.valueOf(8000));
|
||||
tableWidth.setW(BigInteger.valueOf(8311));
|
||||
|
||||
|
||||
//第1行
|
||||
@@ -615,12 +624,12 @@ public class WordUtil {
|
||||
//表格宽度
|
||||
CTJc cTJc = tablePr.addNewJc();
|
||||
//居中
|
||||
cTJc.setVal(STJc.CENTER);
|
||||
cTJc.setVal(STJc.LEFT);
|
||||
//列宽自动分割
|
||||
CTTblWidth tableWidth = tablePr.addNewTblW();
|
||||
//设置表格宽度
|
||||
tableWidth.setType(STTblWidth.DXA);
|
||||
tableWidth.setW(BigInteger.valueOf(8000));
|
||||
tableWidth.setW(BigInteger.valueOf(8311));
|
||||
|
||||
|
||||
//第1行
|
||||
@@ -662,12 +671,12 @@ public class WordUtil {
|
||||
//表格宽度
|
||||
CTJc cTJc = tablePr.addNewJc();
|
||||
//居中
|
||||
cTJc.setVal(STJc.CENTER);
|
||||
cTJc.setVal(STJc.LEFT);
|
||||
//列宽自动分割
|
||||
CTTblWidth tableWidth = tablePr.addNewTblW();
|
||||
//设置表格宽度
|
||||
tableWidth.setType(STTblWidth.DXA);
|
||||
tableWidth.setW(BigInteger.valueOf(8000));
|
||||
tableWidth.setW(BigInteger.valueOf(8311));
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
setCellAskOne(table,"序号","计划号","标准名称","征求意见截止日期");
|
||||
}else{
|
||||
@@ -700,12 +709,12 @@ public class WordUtil {
|
||||
//表格宽度
|
||||
CTJc cTJc = tablePr.addNewJc();
|
||||
//居中
|
||||
cTJc.setVal(STJc.CENTER);
|
||||
cTJc.setVal(STJc.LEFT);
|
||||
//列宽自动分割
|
||||
CTTblWidth tableWidth = tablePr.addNewTblW();
|
||||
//设置表格宽度
|
||||
tableWidth.setType(STTblWidth.DXA);
|
||||
tableWidth.setW(BigInteger.valueOf(8000));
|
||||
tableWidth.setW(BigInteger.valueOf(8311));
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
setCellIssueOne(table,"序号","标准编号","标准名称","发布日期","实施日期");
|
||||
}else{
|
||||
@@ -733,19 +742,19 @@ public class WordUtil {
|
||||
//设置每个单元格宽度
|
||||
CTTblWidth ctTblWidth0 = table.getRow(i).getCell(0).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth0.setType(STTblWidth.DXA);
|
||||
ctTblWidth0.setW(BigInteger.valueOf(1000));
|
||||
ctTblWidth0.setW(BigInteger.valueOf(703));
|
||||
|
||||
CTTblWidth ctTblWidth1 = table.getRow(i).getCell(1).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth1.setType(STTblWidth.DXA);
|
||||
ctTblWidth1.setW(BigInteger.valueOf(2000));
|
||||
ctTblWidth1.setW(BigInteger.valueOf(1984));
|
||||
|
||||
CTTblWidth ctTblWidth2 = table.getRow(i).getCell(2).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth2.setType(STTblWidth.DXA);
|
||||
ctTblWidth2.setW(BigInteger.valueOf(2500));
|
||||
ctTblWidth2.setW(BigInteger.valueOf(3543));
|
||||
|
||||
CTTblWidth ctTblWidth3 = table.getRow(i).getCell(3).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth3.setType(STTblWidth.DXA);
|
||||
ctTblWidth3.setW(BigInteger.valueOf(2500));
|
||||
ctTblWidth3.setW(BigInteger.valueOf(2081));
|
||||
|
||||
table.getRow(i).getCell(0).setText(String.valueOf(i));
|
||||
table.getRow(i).getCell(1).setText(planNumber);
|
||||
@@ -759,23 +768,23 @@ public class WordUtil {
|
||||
//设置每个单元格宽度
|
||||
CTTblWidth ctTblWidth0 = table.getRow(i).getCell(0).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth0.setType(STTblWidth.DXA);
|
||||
ctTblWidth0.setW(BigInteger.valueOf(1000));
|
||||
ctTblWidth0.setW(BigInteger.valueOf(708));
|
||||
|
||||
CTTblWidth ctTblWidth1 = table.getRow(i).getCell(1).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth1.setType(STTblWidth.DXA);
|
||||
ctTblWidth1.setW(BigInteger.valueOf(2000));
|
||||
ctTblWidth1.setW(BigInteger.valueOf(1990));
|
||||
|
||||
CTTblWidth ctTblWidth2 = table.getRow(i).getCell(2).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth2.setType(STTblWidth.DXA);
|
||||
ctTblWidth2.setW(BigInteger.valueOf(2600));
|
||||
ctTblWidth2.setW(BigInteger.valueOf(3124));
|
||||
|
||||
CTTblWidth ctTblWidth3 = table.getRow(i).getCell(3).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth3.setType(STTblWidth.DXA);
|
||||
ctTblWidth3.setW(BigInteger.valueOf(1200));
|
||||
ctTblWidth3.setW(BigInteger.valueOf(1247));
|
||||
|
||||
CTTblWidth ctTblWidth4 = table.getRow(i).getCell(4).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth4.setType(STTblWidth.DXA);
|
||||
ctTblWidth4.setW(BigInteger.valueOf(1200));
|
||||
ctTblWidth4.setW(BigInteger.valueOf(1247));
|
||||
|
||||
table.getRow(i).getCell(0).setText(String.valueOf(i));
|
||||
table.getRow(i).getCell(1).setText(planNumber);
|
||||
@@ -790,23 +799,23 @@ public class WordUtil {
|
||||
//设置每个单元格宽度
|
||||
CTTblWidth ctTblWidth0 = table.getRow(0).getCell(0).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth0.setType(STTblWidth.DXA);
|
||||
ctTblWidth0.setW(BigInteger.valueOf(1000));
|
||||
ctTblWidth0.setW(BigInteger.valueOf(708));
|
||||
|
||||
CTTblWidth ctTblWidth1 = table.getRow(0).getCell(1).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth1.setType(STTblWidth.DXA);
|
||||
ctTblWidth1.setW(BigInteger.valueOf(2000));
|
||||
ctTblWidth1.setW(BigInteger.valueOf(1990));
|
||||
|
||||
CTTblWidth ctTblWidth2 = table.getRow(0).getCell(2).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth2.setType(STTblWidth.DXA);
|
||||
ctTblWidth2.setW(BigInteger.valueOf(2600));
|
||||
ctTblWidth2.setW(BigInteger.valueOf(3124));
|
||||
|
||||
CTTblWidth ctTblWidth3 = table.getRow(0).getCell(3).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth3.setType(STTblWidth.DXA);
|
||||
ctTblWidth3.setW(BigInteger.valueOf(1200));
|
||||
ctTblWidth3.setW(BigInteger.valueOf(1247));
|
||||
|
||||
CTTblWidth ctTblWidth4 = table.getRow(0).getCell(4).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth4.setType(STTblWidth.DXA);
|
||||
ctTblWidth4.setW(BigInteger.valueOf(1200));
|
||||
ctTblWidth4.setW(BigInteger.valueOf(1247));
|
||||
|
||||
table.getRow(0).getCell(0).setText(number);
|
||||
table.getRow(0).getCell(1).setText(planNumber);
|
||||
@@ -821,19 +830,19 @@ public class WordUtil {
|
||||
//设置每个单元格宽度
|
||||
CTTblWidth ctTblWidth0 = table.getRow(0).getCell(0).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth0.setType(STTblWidth.DXA);
|
||||
ctTblWidth0.setW(BigInteger.valueOf(1000));
|
||||
ctTblWidth0.setW(BigInteger.valueOf(703));
|
||||
|
||||
CTTblWidth ctTblWidth1 = table.getRow(0).getCell(1).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth1.setType(STTblWidth.DXA);
|
||||
ctTblWidth1.setW(BigInteger.valueOf(2000));
|
||||
ctTblWidth1.setW(BigInteger.valueOf(1984));
|
||||
|
||||
CTTblWidth ctTblWidth2 = table.getRow(0).getCell(2).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth2.setType(STTblWidth.DXA);
|
||||
ctTblWidth2.setW(BigInteger.valueOf(2500));
|
||||
ctTblWidth2.setW(BigInteger.valueOf(3543));
|
||||
|
||||
CTTblWidth ctTblWidth3 = table.getRow(0).getCell(3).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth3.setType(STTblWidth.DXA);
|
||||
ctTblWidth3.setW(BigInteger.valueOf(2500));
|
||||
ctTblWidth3.setW(BigInteger.valueOf(2081));
|
||||
|
||||
table.getRow(0).getCell(0).setText(number);
|
||||
table.getRow(0).getCell(1).setText(planNumber);
|
||||
@@ -871,10 +880,10 @@ public class WordUtil {
|
||||
table.getRow(number).setHeight(500);
|
||||
CTTblWidth ctTblWidth0 = table.getRow(number).getCell(0).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth0.setType(STTblWidth.DXA);
|
||||
ctTblWidth0.setW(BigInteger.valueOf(2000));
|
||||
ctTblWidth0.setW(BigInteger.valueOf(2296));//宽度通过计算得来-->列表实际宽度除以2.54再乘以1440
|
||||
CTTblWidth ctTblWidth1 = table.getRow(number).getCell(1).getCTTc().addNewTcPr().addNewTcW();
|
||||
ctTblWidth1.setType(STTblWidth.DXA);
|
||||
ctTblWidth1.setW(BigInteger.valueOf(6000));
|
||||
ctTblWidth1.setW(BigInteger.valueOf(6015));
|
||||
|
||||
// XWPFParagraph para = table.getRow(number).getCell(1).getParagraphs().get(0);
|
||||
// XWPFRun run = para.createRun();//对某个段落设置格式
|
||||
|
||||
Reference in New Issue
Block a user