Java Code Examples for org.docx4j.wml.PPr#getShd()

The following examples show how to use org.docx4j.wml.PPr#getShd() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WmlElementUtils.java    From docx4j-template with Apache License 2.0 5 votes vote down vote up
/**
 * @Description: 设置段落底纹(对整段文字起作用)
 */
public static void setParagraphShdStyle(P p, STShd shdType, String shdColor) {
    PPr ppr = getPPr(p);
    CTShd ctShd = ppr.getShd();
    if (ctShd == null) {
        ctShd = new CTShd();
    }
    if (StringUtils.isNotBlank(shdColor)) {
        ctShd.setColor(shdColor);
    }
    if (shdType != null) {
        ctShd.setVal(shdType);
    }
    ppr.setShd(ctShd);
}
 
Example 2
Source File: Docx4j_工具类_S3_Test.java    From docx4j-template with Apache License 2.0 5 votes vote down vote up
/**
 * @Description: 设置段落底纹(对整段文字起作用)
 */
public void setParagraphShdStyle(P p, STShd shdType, String shdColor) {
    PPr ppr = getPPr(p);
    CTShd ctShd = ppr.getShd();
    if (ctShd == null) {
        ctShd = new CTShd();
    }
    if (StringUtils.isNotBlank(shdColor)) {
        ctShd.setColor(shdColor);
    }
    if (shdType != null) {
        ctShd.setVal(shdType);
    }
    ppr.setShd(ctShd);
}