use of org.docx4j.wml.PPrBase.PBdr in project docx4j-template by vindell.
the class Docx4j_工具类_S3_Test method setParagraghBorders.
/**
* @Description: 设置段落边框样式
*/
public void setParagraghBorders(P p, CTBorder topBorder, CTBorder bottomBorder, CTBorder leftBorder, CTBorder rightBorder) {
PPr ppr = getPPr(p);
PBdr pBdr = new PBdr();
if (topBorder != null) {
pBdr.setTop(topBorder);
}
if (bottomBorder != null) {
pBdr.setBottom(bottomBorder);
}
if (leftBorder != null) {
pBdr.setLeft(leftBorder);
}
if (rightBorder != null) {
pBdr.setRight(rightBorder);
}
ppr.setPBdr(pBdr);
}
use of org.docx4j.wml.PPrBase.PBdr in project docx4j-template by vindell.
the class Docx4J_例子2 method newImage.
public P newImage(WordprocessingMLPackage wordMLPackage, ObjectFactory factory, Part sourcePart, byte[] bytes, String filenameHint, String altText, int id1, int id2, boolean isUnderLine, String underLineSize, JcEnumeration jcEnumeration) throws Exception {
BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, sourcePart, bytes);
Inline inline = imagePart.createImageInline(filenameHint, altText, id1, id2, false);
P p = factory.createP();
R run = factory.createR();
p.getContent().add(run);
Drawing drawing = factory.createDrawing();
run.getContent().add(drawing);
drawing.getAnchorOrInline().add(inline);
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);
p.setPPr(pPr);
if (isUnderLine) {
PBdr pBdr = pPr.getPBdr();
if (pBdr == null) {
pBdr = factory.createPPrBasePBdr();
}
CTBorder value = new CTBorder();
value.setVal(STBorder.SINGLE);
value.setColor("000000");
value.setSpace(new BigInteger("0"));
value.setSz(new BigInteger(underLineSize));
pBdr.setBetween(value);
pPr.setPBdr(pBdr);
}
setParagraphSpacing(factory, p, jcEnumeration, true, "0", "0", null, null, true, "240", STLineSpacingRule.AUTO);
return p;
}
use of org.docx4j.wml.PPrBase.PBdr in project docx4j-template by vindell.
the class Docx4J_例子2 method createParagraghLine.
public void createParagraghLine(WordprocessingMLPackage wordMLPackage, MainDocumentPart t, ObjectFactory factory, P p, CTBorder topBorder, CTBorder bottomBorder, CTBorder leftBorder, CTBorder rightBorder) {
PPr ppr = new PPr();
PBdr pBdr = new PBdr();
pBdr.setTop(topBorder);
pBdr.setBottom(bottomBorder);
pBdr.setLeft(leftBorder);
pBdr.setRight(rightBorder);
ppr.setPBdr(pBdr);
p.setPPr(ppr);
}
use of org.docx4j.wml.PPrBase.PBdr in project docx4j-template by vindell.
the class Docx4J_简单例子2 method getTextHdr.
public Hdr getTextHdr(WordprocessingMLPackage wordprocessingMLPackage, ObjectFactory factory, Part sourcePart, String content, JcEnumeration jcEnumeration) throws Exception {
Hdr hdr = factory.createHdr();
P headP = factory.createP();
Text text = factory.createText();
text.setValue(content);
R run = factory.createR();
run.getContent().add(text);
headP.getContent().add(run);
PPr pPr = headP.getPPr();
if (pPr == null) {
pPr = factory.createPPr();
}
Jc jc = pPr.getJc();
if (jc == null) {
jc = new Jc();
}
jc.setVal(jcEnumeration);
pPr.setJc(jc);
PBdr pBdr = pPr.getPBdr();
if (pBdr == null) {
pBdr = factory.createPPrBasePBdr();
}
CTBorder value = new CTBorder();
value.setVal(STBorder.SINGLE);
value.setColor("000000");
value.setSpace(new BigInteger("0"));
value.setSz(new BigInteger("3"));
pBdr.setBetween(value);
pPr.setPBdr(pBdr);
headP.setPPr(pPr);
setParagraphSpacing(factory, headP, jcEnumeration, "0", "0");
hdr.getContent().add(headP);
hdr.getContent().add(createHeaderBlankP(wordprocessingMLPackage, factory, jcEnumeration));
return hdr;
}
use of org.docx4j.wml.PPrBase.PBdr in project docx4j-template by vindell.
the class Docx4J_简单例子2 method createHeaderBlankP.
public P createHeaderBlankP(WordprocessingMLPackage wordMLPackage, ObjectFactory factory, JcEnumeration jcEnumeration) throws Exception {
P p = factory.createP();
R run = factory.createR();
p.getContent().add(run);
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);
PBdr pBdr = pPr.getPBdr();
if (pBdr == null) {
pBdr = factory.createPPrBasePBdr();
}
CTBorder value = new CTBorder();
value.setVal(STBorder.SINGLE);
value.setColor("000000");
value.setSpace(new BigInteger("0"));
value.setSz(new BigInteger("3"));
pBdr.setBetween(value);
pPr.setPBdr(pBdr);
p.setPPr(pPr);
setParagraphSpacing(factory, p, jcEnumeration, "0", "0");
return p;
}
Aggregations