本文整理汇总了Java中org.docx4j.wml.PPr.setJc方法的典型用法代码示例。如果您正苦于以下问题:Java PPr.setJc方法的具体用法?Java PPr.setJc怎么用?Java PPr.setJc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.docx4j.wml.PPr
的用法示例。
在下文中一共展示了PPr.setJc方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAlignment
import org.docx4j.wml.PPr; //导入方法依赖的package包/类
/**
* Gets a center aligned PPr for P
* @return
*/
protected PPr setAlignment(ALIGN align) {
ObjectFactory wmlObjectFactory = new ObjectFactory();
PPr ppr = wmlObjectFactory.createPPr();
Jc jc = wmlObjectFactory.createJc();
JcEnumeration jcEnumeration = JcEnumeration.CENTER;
if (align!=null) {
switch (align) {
case LEFT:
jcEnumeration = JcEnumeration.LEFT;
break;
case RIGHT:
jcEnumeration = JcEnumeration.RIGHT;
break;
}
}
ppr.setJc(jc);
jc.setVal(jcEnumeration);
return ppr;
}
示例2: setStyleMLA
import org.docx4j.wml.PPr; //导入方法依赖的package包/类
void setStyleMLA(Style style, boolean justify) {
ObjectFactory factory = Context.getWmlObjectFactory();
PPr paragraphProperties = factory.createPPr();
Jc justification = factory.createJc();
if (justify)
justification.setVal(JcEnumeration.BOTH);
else
justification.setVal(JcEnumeration.CENTER);
paragraphProperties.setJc(justification);
Spacing sp = factory.createPPrBaseSpacing();
sp.setAfter(BigInteger.ZERO);
sp.setBefore(BigInteger.ZERO);
sp.setLine(BigInteger.valueOf(482));
sp.setLineRule(STLineSpacingRule.AUTO);
paragraphProperties.setSpacing(sp);
style.setPPr(paragraphProperties);
RPr rpr = new RPr();
changeFont(rpr, "Times New Roman");
style.setRPr(rpr);
}
示例3: createPageNumParagraph
import org.docx4j.wml.PPr; //导入方法依赖的package包/类
private P createPageNumParagraph() {
CTSimpleField pgnum = factory.createCTSimpleField();
pgnum.setInstr(" PAGE \\* MERGEFORMAT ");
RPr RPr = factory.createRPr();
RPr.setNoProof(new BooleanDefaultTrue());
PPr ppr = factory.createPPr();
Jc jc = factory.createJc();
jc.setVal(JcEnumeration.CENTER);
ppr.setJc(jc);
PPrBase.Spacing pprbase = factory.createPPrBaseSpacing();
pprbase.setBefore(BigInteger.valueOf(240));
pprbase.setAfter(BigInteger.valueOf(0));
ppr.setSpacing(pprbase);
R run = factory.createR();
run.getContent().add(RPr);
pgnum.getContent().add(run);
JAXBElement<CTSimpleField> fldSimple = factory.createPFldSimple(pgnum);
P para = createParagraph();
para.getContent().add(fldSimple);
para.setPPr(ppr);
return para;
}
示例4: createParagraphWithHAlign
import org.docx4j.wml.PPr; //导入方法依赖的package包/类
/**
* 创建段落设置水平对齐方式
* @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;
}
示例5: setHorizontalAlignment
import org.docx4j.wml.PPr; //导入方法依赖的package包/类
public void setHorizontalAlignment(P paragraph, JcEnumeration hAlign) {
if (hAlign != null) {
PPr pprop = new PPr();
Jc align = new Jc();
align.setVal(hAlign);
pprop.setJc(align);
paragraph.setPPr(pprop);
}
}
示例6: paragraphProperties
import org.docx4j.wml.PPr; //导入方法依赖的package包/类
private PPr paragraphProperties(final Spacing spacing, final PBdr border, final Jc alignment, final boolean keepNext) {
final PPr ppr = this.wmlObjectFactory.createPPr();
ppr.setPBdr(border);
ppr.setSpacing(spacing);
ppr.setJc(alignment);
final BooleanDefaultTrue trueElement = this.wmlObjectFactory.createBooleanDefaultTrue();
trueElement.setVal(keepNext);
ppr.setKeepNext(trueElement);
ppr.setContextualSpacing(trueElement);
return ppr;
}
示例7: createIt
import org.docx4j.wml.PPr; //导入方法依赖的package包/类
public static P createIt() {
org.docx4j.wml.ObjectFactory wmlObjectFactory = new org.docx4j.wml.ObjectFactory();
P p = wmlObjectFactory.createP();
// Create object for pPr
PPr ppr = wmlObjectFactory.createPPr();
p.setPPr(ppr);
// Create object for rPr
ParaRPr pararpr = wmlObjectFactory.createParaRPr();
ppr.setRPr(pararpr);
// Create object for u
U u = wmlObjectFactory.createU();
pararpr.setU(u);
u.setVal(org.docx4j.wml.UnderlineEnumeration.SINGLE);
// Create object for lang
CTLanguage language = wmlObjectFactory.createCTLanguage();
pararpr.setLang(language);
language.setVal( "en-AU");
// Create object for jc
Jc jc = wmlObjectFactory.createJc();
ppr.setJc(jc);
jc.setVal(org.docx4j.wml.JcEnumeration.CENTER);
// Create object for r
R r = wmlObjectFactory.createR();
p.getContent().add( r);
// Create object for rPr
RPr rpr = wmlObjectFactory.createRPr();
r.setRPr(rpr);
// Create object for u
U u2 = wmlObjectFactory.createU();
rpr.setU(u2);
u2.setVal(org.docx4j.wml.UnderlineEnumeration.SINGLE);
// Create object for lang
CTLanguage language2 = wmlObjectFactory.createCTLanguage();
rpr.setLang(language2);
language2.setVal( "en-AU");
// Create object for t (wrapped in JAXBElement)
Text text = wmlObjectFactory.createText();
JAXBElement<org.docx4j.wml.Text> textWrapped = wmlObjectFactory.createRT(text);
r.getContent().add( textWrapped);
text.setValue( "Underlined and centred");
return p;
}