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);
}
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;
}
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);
}
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);
}
}
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);
}
Aggregations