Search in sources :

Example 11 with PPr

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

the class Docx4J_简单例子2 method setParagraphSpacing.

// 设置段落间距
public void setParagraphSpacing(ObjectFactory factory, P p, JcEnumeration jcEnumeration, String before, String after) {
    PPr pPr = p.getPPr();
    if (pPr == null) {
        pPr = factory.createPPr();
    }
    Jc jc = pPr.getJc();
    if (jc == null) {
        jc = new Jc();
    }
    jc.setVal(jcEnumeration);
    pPr.setJc(jc);
    Spacing spacing = new Spacing();
    spacing.setBefore(new BigInteger(before));
    spacing.setAfter(new BigInteger(after));
    spacing.setLineRule(STLineSpacingRule.AUTO);
    pPr.setSpacing(spacing);
    p.setPPr(pPr);
}
Also used : PPr(org.docx4j.wml.PPr) STVerticalJc(org.docx4j.wml.STVerticalJc) Jc(org.docx4j.wml.Jc) CTVerticalJc(org.docx4j.wml.CTVerticalJc) BigInteger(java.math.BigInteger) Spacing(org.docx4j.wml.PPrBase.Spacing)

Example 12 with PPr

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

the class Docx4j_Helper method createParagraphWithHAlign.

/**
 * 创建段落设置水平对齐方式
 * @return
 */
private P createParagraphWithHAlign() {
    P p;
    PPr pPr;
    p = Docx4j_Helper.factory.createP();
    pPr = Docx4j_Helper.factory.createPPr();
    Jc jc = Docx4j_Helper.factory.createJc();
    jc.setVal(JcEnumeration.CENTER);
    pPr.setJc(jc);
    p.setPPr(pPr);
    return p;
}
Also used : P(org.docx4j.wml.P) PPr(org.docx4j.wml.PPr) Jc(org.docx4j.wml.Jc)

Example 13 with PPr

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

the class Docx4j_创建批注_S3_Test method setParagraphAlign.

// 段落对齐方式
public void setParagraphAlign(ObjectFactory factory, P p, JcEnumeration jcEnumeration, TextAlignment textAlign) {
    PPr pPr = p.getPPr();
    if (pPr == null) {
        pPr = factory.createPPr();
    }
    if (jcEnumeration != null) {
        Jc jc = pPr.getJc();
        if (jc == null) {
            jc = new Jc();
        }
        jc.setVal(jcEnumeration);
        pPr.setJc(jc);
    }
    if (textAlign != null) {
        pPr.setTextAlignment(textAlign);
    }
    p.setPPr(pPr);
}
Also used : PPr(org.docx4j.wml.PPr) Jc(org.docx4j.wml.Jc)

Example 14 with PPr

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

the class Docx4j_创建批注_S3_Test method setParagraphShdStyle.

// 段落底纹
public void setParagraphShdStyle(ObjectFactory factory, P p, boolean isShd, STShd shdValue, String shdColor) {
    if (isShd) {
        PPr ppr = factory.createPPr();
        CTShd shd = new CTShd();
        if (shdColor != null) {
            shd.setColor(shdColor);
        }
        if (shdValue != null) {
            shd.setVal(shdValue);
        }
        ppr.setShd(shd);
        p.setPPr(ppr);
    }
}
Also used : PPr(org.docx4j.wml.PPr) CTShd(org.docx4j.wml.CTShd)

Example 15 with PPr

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

the class Docx4j_工具类_S3_Test method setParagraphShdStyle.

/**
 * @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);
}
Also used : PPr(org.docx4j.wml.PPr) CTShd(org.docx4j.wml.CTShd)

Aggregations

PPr (org.docx4j.wml.PPr)48 Jc (org.docx4j.wml.Jc)29 R (org.docx4j.wml.R)23 P (org.docx4j.wml.P)22 CTVerticalJc (org.docx4j.wml.CTVerticalJc)21 STVerticalJc (org.docx4j.wml.STVerticalJc)20 BigInteger (java.math.BigInteger)17 Text (org.docx4j.wml.Text)14 PBdr (org.docx4j.wml.PPrBase.PBdr)10 CTBorder (org.docx4j.wml.CTBorder)9 RPr (org.docx4j.wml.RPr)6 Inline (org.docx4j.dml.wordprocessingDrawing.Inline)5 BinaryPartAbstractImage (org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage)5 Drawing (org.docx4j.wml.Drawing)5 Spacing (org.docx4j.wml.PPrBase.Spacing)5 Ftr (org.docx4j.wml.Ftr)4 ObjectFactory (org.docx4j.wml.ObjectFactory)4 ParaRPr (org.docx4j.wml.ParaRPr)4 Ind (org.docx4j.wml.PPrBase.Ind)3 Tc (org.docx4j.wml.Tc)3