当前位置: 首页>>代码示例>>Java>>正文


Java P.setPPr方法代码示例

本文整理汇总了Java中org.docx4j.wml.P.setPPr方法的典型用法代码示例。如果您正苦于以下问题:Java P.setPPr方法的具体用法?Java P.setPPr怎么用?Java P.setPPr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.docx4j.wml.P的用法示例。


在下文中一共展示了P.setPPr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createHorizontalLine

import org.docx4j.wml.P; //导入方法依赖的package包/类
public static P createHorizontalLine() {

		org.docx4j.wml.ObjectFactory wmlObjectFactory = new org.docx4j.wml.ObjectFactory();

		// Create object for p
		P p = wmlObjectFactory.createP();
		// Create object for pPr
		PPr ppr = wmlObjectFactory.createPPr();
		p.setPPr(ppr);
		// Create object for pBdr
		PPrBase.PBdr pprbasepbdr = wmlObjectFactory.createPPrBasePBdr();
		ppr.setPBdr(pprbasepbdr);
		// Create object for bottom
		CTBorder border = wmlObjectFactory.createCTBorder();
		pprbasepbdr.setBottom(border);
		border.setVal(org.docx4j.wml.STBorder.SINGLE);
		border.setSz(BigInteger.valueOf(6));
		border.setColor("auto");
		border.setSpace(BigInteger.valueOf(1));

		return p;
	}
 
开发者ID:ShapeChange,项目名称:ShapeChange,代码行数:23,代码来源:DocxUtil.java

示例2: addHeaderParagraphOfText

import org.docx4j.wml.P; //导入方法依赖的package包/类
/**
 *
 * @param mainDocumentPart
 * @param workItemID
 * @param simpleText
 * @param styleId
 * @return
 */
private static P addHeaderParagraphOfText(MainDocumentPart mainDocumentPart, Integer workItemID, String simpleText, String styleId) {
	ObjectFactory factory = Context.getWmlObjectFactory();
	P p = factory.createP();
	if (simpleText!=null) {
		Text t = factory.createText();
		t.setValue(simpleText);
		R run = factory.createR();
		run.getContent().add(t);
		p.getContent().add(run);
		BookmarkAdd.bookmarkRun(p, run, ITEM_BOOKMARK_PREFIX+workItemID, workItemID);
	}
	if (mainDocumentPart.getPropertyResolver().activateStyle(styleId)) {
		// Style is available
		org.docx4j.wml.PPr  pPr = factory.createPPr();
		p.setPPr(pPr);
		org.docx4j.wml.PPrBase.PStyle pStyle = factory.createPPrBasePStyle();
		pPr.setPStyle(pStyle);
		pStyle.setVal(styleId);
	} else {
		LOGGER.debug("StyleID " + styleId + " not available");
	}
	return p;
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:32,代码来源:AssembleWordprocessingMLPackage.java

示例3: apply

import org.docx4j.wml.P; //导入方法依赖的package包/类
@Override
public void apply(P imageParagraph, Object parent, List<Object> siblings) {
	SingleTraversalUtilVisitorCallback imageVisitor = new SingleTraversalUtilVisitorCallback(new TraversalUtilDrawingVisitor());
	imageVisitor.walkJAXBElements(imageParagraph);
	if (foundDrawingInParagraph) {
		ImageOrTableCaption imageCaption = captionsMap.get(captionKey);
		if (imageCaption!=null) {
			//add only for imageCaptionsMap contents i.e. programmatically added images (not for eventually existing images in word template)
			P captionParagraph = createCaption(figurePrefix, imageCaption, captionStyleId);
			ContentAccessor contentAccessor = (ContentAccessor)parent;
			List<Object> contentList = contentAccessor.getContent();
			for (int i = 0; i < contentList.size(); i++) {
				Object object = contentList.get(i);
				if (imageParagraph.equals(object)) {
					//align to center
					imageParagraph.setPPr(setAlignment(imageCaption.getAlign()));
					imageParagraphToCaptionParagraphMap.put(imageParagraph, captionParagraph);
					imageParagraphToParentMap.put(imageParagraph, contentAccessor);
					break;
				}
			}
		}
	}
	foundDrawingInParagraph = false;
	captionKey = null;
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:27,代码来源:PostprocessImage.java

示例4: createPageNumParagraph

import org.docx4j.wml.P; //导入方法依赖的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;
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:25,代码来源:DocxExporter.java

示例5: createParagraphWithHAlign

import org.docx4j.wml.P; //导入方法依赖的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;  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:16,代码来源:Docx4j_Helper.java

示例6: createParagraghLine

import org.docx4j.wml.P; //导入方法依赖的package包/类
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);
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:12,代码来源:Docx4J_例子2.java

示例7: setParagraphShdStyle

import org.docx4j.wml.P; //导入方法依赖的package包/类
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);  
    }  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:16,代码来源:Docx4j_创建批注_S3_Test.java

示例8: setParagraphSpacing

import org.docx4j.wml.P; //导入方法依赖的package包/类
public void setParagraphSpacing(ObjectFactory factory, P p,  
        boolean isSpace, String before, String after, boolean isLines,  
        String beforeLines, String afterLines, boolean isLineRule,  
        String lineValue, STLineSpacingRule sTLineSpacingRule) {  
    PPr pPr = p.getPPr();  
    if (pPr == null) {  
        pPr = factory.createPPr();  
    }  
    Spacing spacing = new Spacing();  
    if (isSpace) {  
        if (before != null) {  
            // 段前磅数  
            spacing.setBefore(new BigInteger(before));  
        }  
        if (after != null) {  
            // 段后磅数  
            spacing.setAfter(new BigInteger(after));  
        }  
    }  
    if (isLines) {  
        if (beforeLines != null) {  
            // 段前行数  
            spacing.setBeforeLines(new BigInteger(beforeLines));  
        }  
        if (afterLines != null) {  
            // 段后行数  
            spacing.setAfterLines(new BigInteger(afterLines));  
        }  
    }  
    if (isLineRule) {  
        if (lineValue != null) {  
            spacing.setLine(new BigInteger(lineValue));  
        }  
        spacing.setLineRule(sTLineSpacingRule);  
    }  
    pPr.setSpacing(spacing);  
    p.setPPr(pPr);  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:39,代码来源:Docx4j_创建批注_S3_Test.java

示例9: setHorizontalAlignment

import org.docx4j.wml.P; //导入方法依赖的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);  
    }  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:10,代码来源:Docx4j_创建表格_S5_Test.java

示例10: createFillerP

import org.docx4j.wml.P; //导入方法依赖的package包/类
private static P createFillerP() {

    	org.docx4j.wml.ObjectFactory wmlObjectFactory = Context.getWmlObjectFactory();

    	P p = wmlObjectFactory.createP(); 
    	    // Create object for pPr
    	    PPr ppr = wmlObjectFactory.createPPr(); 
    	    p.setPPr(ppr); 
    	        // Create object for rPr
    	        ParaRPr pararpr = wmlObjectFactory.createParaRPr(); 

    	        // Create object for spacing
    	        PPrBase.Spacing pprbasespacing = wmlObjectFactory.createPPrBaseSpacing(); 
    	        ppr.setSpacing(pprbasespacing); 
    	            pprbasespacing.setBefore( BigInteger.valueOf( 800) ); 
    	            pprbasespacing.setAfter( BigInteger.valueOf( 800) ); 
    	    // 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 sz
    	            HpsMeasure hpsmeasure3 = wmlObjectFactory.createHpsMeasure(); 
    	            rpr.setSz(hpsmeasure3); 
    	                hpsmeasure3.setVal( BigInteger.valueOf( 96) ); 

    	        // 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( "BODY CONTENT"); 

    	return p;
    }
 
开发者ID:plutext,项目名称:docx4j-export-FO,代码行数:36,代码来源:FOPAreaTreeHelper.java

示例11: createParagraph

import org.docx4j.wml.P; //导入方法依赖的package包/类
private P createParagraph(final String styleId, final R... runs) {
	final P p = this.wmlObjectFactory.createP();

	final PPr ppr = this.wmlObjectFactory.createPPr();
	p.setPPr(ppr);

	final PStyle pstyle = this.wmlObjectFactory.createPPrBasePStyle();
	pstyle.setVal(styleId);
	ppr.setPStyle(pstyle);

	p.getContent().addAll(Arrays.asList(runs));

	return p;
}
 
开发者ID:mizitch,项目名称:story-inspector,代码行数:15,代码来源:DocXReportSummaryWriter.java

示例12: generateCommentContent

import org.docx4j.wml.P; //导入方法依赖的package包/类
private P generateCommentContent(final String content) {
	final P paragraph = this.wmlObjectFactory.createP();
	final PPr paragraphProperties = this.wmlObjectFactory.createPPr();
	paragraph.setPPr(paragraphProperties);

	paragraph.getContent().add(createRunWithContent(Collections.singletonList(createTextElement(content)), this.wmlObjectFactory.createRPr()));

	return paragraph;
}
 
开发者ID:mizitch,项目名称:story-inspector,代码行数:10,代码来源:DocXReportTranscriber.java

示例13: apply

import org.docx4j.wml.P; //导入方法依赖的package包/类
@Override
public void apply(P p, Object parent, List<Object> siblings) {
	//apply the inline style for each run
	SingleTraversalUtilVisitorCallback runVisitor = new SingleTraversalUtilVisitorCallback(new TraversalUtilRunVisitor());
	runVisitor.walkJAXBElements(p);
	ObjectFactory wmlObjectFactory = new ObjectFactory();
	PPr ppr = p.getPPr();
	if (ppr==null) {
		ppr = wmlObjectFactory.createPPr();
	    p.setPPr(ppr);
	}
	//apply the inline style for run at paragraph level
    if (runWithTextFound) {
    	if (inlineContentStyleIsParagraphStyle) {
		    // Create object for pStyle
		    PPrBase.PStyle pprbasepstyle = wmlObjectFactory.createPPrBasePStyle();
		    ppr.setPStyle(pprbasepstyle);
		    pprbasepstyle.setVal(inlineStyleId);
		    
    	} else {
           // Create object for rStyle
           RStyle rstyle = wmlObjectFactory.createRStyle(); 
           ParaRPr paraRpr = ppr.getRPr();
           if (paraRpr==null) {
	    	paraRpr = wmlObjectFactory.createParaRPr();
	    	ppr.setRPr(paraRpr);
	    }
           paraRpr.setRStyle(rstyle); 
           rstyle.setVal(inlineStyleId); 
    	}
    }
    runWithTextFound = false;
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:34,代码来源:InlineStyleUtil.java

示例14: createParagraph

import org.docx4j.wml.P; //导入方法依赖的package包/类
private P createParagraph(BandElement be) {
	P paragraph = factory.createP();
	PPr pPr = factory.createPPr();
	Spacing spacing = new Spacing();
	if ((be!= null) && be.isWrapText() && (be.getPercentLineSpacing() > 100)) {			
		spacing.setLine( BigInteger.valueOf( (be.getFont().getSize() * be.getPercentLineSpacing())/2) );
	} 
	spacing.setAfter(BigInteger.ZERO);		
	pPr.setSpacing(spacing);
	paragraph.setPPr(pPr);
	return paragraph;
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:13,代码来源:DocxExporter.java

示例15: testDocx4jSetPageSize

import org.docx4j.wml.P; //导入方法依赖的package包/类
public void testDocx4jSetPageSize() throws Exception {  
    WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();  
    MainDocumentPart mdp = wordMLPackage.getMainDocumentPart();  
  
    String titleStr="静夜思    李白";  
    String str="床前明月光,疑似地上霜。";  
    String str2="举头望明月,低头思故乡。";  
    P p = Docx4j_Helper.factory.createP();  
    String rprStr = "<w:rPr xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"><w:rFonts w:hint=\"eastAsia\" w:ascii=\"Times New Roman\" w:hAnsi=\"Times New Roman\" w:eastAsia=\"宋体\"/><w:b/><w:color w:val=\"333333\"/><w:sz w:val=\"32\"/><w:szCs w:val=\"32\"/></w:rPr>";  
    RPr rpr = (RPr) XmlUtils.unmarshalString(rprStr);  
    setParagraphContent(p, rpr,titleStr);  
    mdp.addObject(p);  
      
    p = Docx4j_Helper.factory.createP();  
    setParagraphContent(p, rpr,str);  
    mdp.addObject(p);  
      
    p = Docx4j_Helper.factory.createP();  
    PPr pPr=Docx4j_Helper.factory.createPPr();  
    //设置文字方向  
    SectPr sectPr = Docx4j_Helper.factory.createSectPr();  
    TextDirection textDirect = Docx4j_Helper.factory.createTextDirection();  
    //文字方向:垂直方向从右往左  
    textDirect.setVal("tbRl");  
    sectPr.setTextDirection(textDirect);  
    Type sectType = Docx4j_Helper.factory.createSectPrType();  
    //下一页  
    sectType.setVal("nextPage");  
    sectPr.setType(sectType);  
    //设置页面大小  
    PgSz pgSz =  Docx4j_Helper.factory.createSectPrPgSz();  
    pgSz.setW(new BigInteger("8335"));  
    pgSz.setH(new BigInteger("11850"));  
    sectPr.setPgSz(pgSz);  
    pPr.setSectPr(sectPr);  
    p.setPPr(pPr);  
    setParagraphContent(p, rpr,str2);  
    mdp.addObject(p);  
      
    p = createParagraphWithHAlign();  
    setParagraphContent(p, rpr,titleStr);  
    mdp.addObject(p);  
      
    p = createParagraphWithHAlign();  
    setParagraphContent(p, rpr,str);  
    mdp.addObject(p);  
      
    p = createParagraphWithHAlign();  
    setParagraphContent(p, rpr,str2);  
    mdp.addObject(p);  
    Docx4j_Helper.saveWordPackage(wordMLPackage, outputfilepath);  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:53,代码来源:Docx4j_Helper.java


注:本文中的org.docx4j.wml.P.setPPr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。