use of org.docx4j.wml.SectPr in project docx4j-template by vindell.
the class Docx4j_工具类_S3_Test method setDocMarginSpace.
/**
* @Description:设置页边距
*/
public void setDocMarginSpace(WordprocessingMLPackage wordPackage, ObjectFactory factory, String top, String left, String bottom, String right) {
SectPr sectPr = getDocSectPr(wordPackage);
PgMar pg = sectPr.getPgMar();
if (pg == null) {
pg = factory.createSectPrPgMar();
sectPr.setPgMar(pg);
}
if (StringUtils.isNotBlank(top)) {
pg.setTop(new BigInteger(top));
}
if (StringUtils.isNotBlank(bottom)) {
pg.setBottom(new BigInteger(bottom));
}
if (StringUtils.isNotBlank(left)) {
pg.setLeft(new BigInteger(left));
}
if (StringUtils.isNotBlank(right)) {
pg.setRight(new BigInteger(right));
}
}
use of org.docx4j.wml.SectPr in project docx4j-template by vindell.
the class Docx4j_工具类_S3_Test method setDocumentSize.
/**
* @Description: 设置页面大小及纸张方向 landscape横向
*/
public void setDocumentSize(WordprocessingMLPackage wordPackage, ObjectFactory factory, String width, String height, STPageOrientation stValue) {
SectPr sectPr = getDocSectPr(wordPackage);
PgSz pgSz = sectPr.getPgSz();
if (pgSz == null) {
pgSz = factory.createSectPrPgSz();
sectPr.setPgSz(pgSz);
}
if (StringUtils.isNotBlank(width)) {
pgSz.setW(new BigInteger(width));
}
if (StringUtils.isNotBlank(height)) {
pgSz.setH(new BigInteger(height));
}
if (stValue != null) {
pgSz.setOrient(stValue);
}
}
use of org.docx4j.wml.SectPr in project docx4j-template by vindell.
the class Docx4j_工具类_S3_Test method setDocInNumType.
/**
* @Description: 设置行号
* @param distance
* :距正文距离 1厘米=567
* @param start
* :起始编号(0开始)
* @param countBy
* :行号间隔
* @param restartType
* :STLineNumberRestart.CONTINUOUS(continuous连续编号)<br/>
* STLineNumberRestart.NEW_PAGE(每页重新编号)<br/>
* STLineNumberRestart.NEW_SECTION(每节重新编号)
*/
public void setDocInNumType(WordprocessingMLPackage wordPackage, String countBy, String distance, String start, STLineNumberRestart restartType) {
SectPr sectPr = getDocSectPr(wordPackage);
CTLineNumber lnNumType = sectPr.getLnNumType();
if (lnNumType == null) {
lnNumType = new CTLineNumber();
sectPr.setLnNumType(lnNumType);
}
if (StringUtils.isNotBlank(countBy)) {
lnNumType.setCountBy(new BigInteger(countBy));
}
if (StringUtils.isNotBlank(distance)) {
lnNumType.setDistance(new BigInteger(distance));
}
if (StringUtils.isNotBlank(start)) {
lnNumType.setStart(new BigInteger(start));
}
if (restartType != null) {
lnNumType.setRestart(restartType);
}
}
Aggregations