use of org.docx4j.wml.Jc in project docx4j-template by vindell.
the class Docx4J_例子2 method getTextFtr.
public Ftr getTextFtr(WordprocessingMLPackage wordprocessingMLPackage, ObjectFactory factory, Part sourcePart, String content, boolean isUnderLine, String underLineSz, JcEnumeration jcEnumeration) throws Exception {
Ftr ftr = factory.createFtr();
P footerP = factory.createP();
Text text = factory.createText();
text.setValue(content);
R run = factory.createR();
run.getContent().add(text);
footerP.getContent().add(run);
PPr pPr = footerP.getPPr();
if (pPr == null) {
pPr = factory.createPPr();
}
Jc jc = pPr.getJc();
if (jc == null) {
jc = new Jc();
}
jc.setVal(jcEnumeration);
pPr.setJc(jc);
footerP.setPPr(pPr);
setParagraphSpacing(factory, footerP, jcEnumeration, true, "0", "0", null, null, true, "240", STLineSpacingRule.AUTO);
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(underLineSz));
pBdr.setBetween(value);
pPr.setPBdr(pBdr);
footerP.setPPr(pPr);
}
ftr.getContent().add(footerP);
if (isUnderLine) {
ftr.getContent().add(createHeaderBlankP(wordprocessingMLPackage, factory, underLineSz, jcEnumeration));
}
return ftr;
}
use of org.docx4j.wml.Jc in project docx4j-template by vindell.
the class Docx4J_例子2 method createHeaderBlankP.
public P createHeaderBlankP(WordprocessingMLPackage wordMLPackage, ObjectFactory factory, String underLineSz, 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(underLineSz));
pBdr.setBetween(value);
pPr.setPBdr(pBdr);
p.setPPr(pPr);
setParagraphSpacing(factory, p, jcEnumeration, true, "0", "0", null, null, true, "240", STLineSpacingRule.AUTO);
return p;
}
use of org.docx4j.wml.Jc in project docx4j-template by vindell.
the class Docx4J_简单例子 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);
headP.setPPr(pPr);
hdr.getContent().add(headP);
return hdr;
}
use of org.docx4j.wml.Jc in project docx4j-template by vindell.
the class Docx4J_简单例子 method setTableAlign.
// 表格水平对齐方式
// TODO 垂直对齐没写
public void setTableAlign(ObjectFactory factory, Tbl table, JcEnumeration jcEnumeration) {
TblPr tablePr = table.getTblPr();
if (tablePr == null) {
tablePr = factory.createTblPr();
}
Jc jc = tablePr.getJc();
if (jc == null) {
jc = new Jc();
}
jc.setVal(jcEnumeration);
tablePr.setJc(jc);
table.setTblPr(tablePr);
}
use of org.docx4j.wml.Jc in project docx4j-template by vindell.
the class Docx4J_简单例子2 method setParagraphAlign.
// 水平对齐方式
// TODO 垂直对齐没写
public void setParagraphAlign(ObjectFactory factory, P p, JcEnumeration jcEnumeration) {
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);
}
Aggregations