Search in sources :

Example 1 with PgBorders

use of org.docx4j.wml.SectPr.PgBorders in project docx4j-template by vindell.

the class Docx4j_工具类_S3_Test method setDocumentBorders.

/**
 * @Description: 设置页面边框
 */
public void setDocumentBorders(WordprocessingMLPackage wordPackage, ObjectFactory factory, CTBorder top, CTBorder right, CTBorder bottom, CTBorder left) {
    SectPr sectPr = getDocSectPr(wordPackage);
    PgBorders pgBorders = sectPr.getPgBorders();
    if (pgBorders == null) {
        pgBorders = factory.createSectPrPgBorders();
        sectPr.setPgBorders(pgBorders);
    }
    if (top != null) {
        pgBorders.setTop(top);
    }
    if (right != null) {
        pgBorders.setRight(right);
    }
    if (bottom != null) {
        pgBorders.setBottom(bottom);
    }
    if (left != null) {
        pgBorders.setLeft(left);
    }
}
Also used : SectPr(org.docx4j.wml.SectPr) PgBorders(org.docx4j.wml.SectPr.PgBorders)

Aggregations

SectPr (org.docx4j.wml.SectPr)1 PgBorders (org.docx4j.wml.SectPr.PgBorders)1