Package org.openxmlformats.schemas.wordprocessingml.x2006.main

Examples of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr


     * This method provides a style to the paragraph
     * This is useful when, e.g. an Heading style has to be assigned
     * @param newStyle
     */
    public void setStyle(String newStyle) {
      CTPPr pr = getCTPPr();
      CTString style = pr.getPStyle() != null ? pr.getPStyle() : pr.addNewPStyle();
      style.setVal(newStyle);
    }
View Full Code Here


    /**
     * Gets the style of the paragraph
     * @return
     */
    public String getStyle() {
      CTPPr pr = getCTPPr();
      CTString style = pr.isSetPStyle() ? pr.getPStyle() : null;
      return style != null ? style.getVal() : null;
    }
View Full Code Here

    /**
     * Get a <b>copy</b> of the currently used CTPBrd, if none is used, return
     * a new instance.
     */
    private CTPBdr getCTPBrd(boolean create) {
        CTPPr pr = getCTPPr();
        CTPBdr ct = pr.isSetPBdr() ? pr.getPBdr() : null;
        if (create && ct == null)
            ct = pr.addNewPBdr();
        return ct;
    }
View Full Code Here

    /**
     * Get a <b>copy</b> of the currently used CTSpacing, if none is used,
     * return a new instance.
     */
    private CTSpacing getCTSpacing(boolean create) {
        CTPPr pr = getCTPPr();
        CTSpacing ct = pr.getSpacing() == null ? null : pr.getSpacing();
        if (create && ct == null)
            ct = pr.addNewSpacing();
        return ct;
    }
View Full Code Here

    /**
     * Get a <b>copy</b> of the currently used CTPInd, if none is used, return
     * a new instance.
     */
    private CTInd getCTInd(boolean create) {
        CTPPr pr = getCTPPr();
        CTInd ct = pr.getInd() == null ? null : pr.getInd();
        if (create && ct == null)
            ct = pr.addNewInd();
        return ct;
    }
View Full Code Here

    /**
     * Get a <b>copy</b> of the currently used CTPPr, if none is used, return
     * a new instance.
     */
    private CTPPr getCTPPr() {
        CTPPr pr = paragraph.getPPr() == null ? paragraph.addNewPPr()
                : paragraph.getPPr();
        return pr;
    }
View Full Code Here

      CTP p = ftr.addNewP();
      byte[] rsidr = doc.getDocument().getBody().getPArray()[0].getRsidR();
      byte[] rsidrdefault = doc.getDocument().getBody().getPArray()[0].getRsidRDefault();
      p.setRsidP(rsidr);
      p.setRsidRDefault(rsidrdefault);
      CTPPr pPr = p.addNewPPr();
      pPr.addNewPStyle().setVal(pStyle);
    }
    return ftr;
  }
View Full Code Here

    CTP p = CTP.Factory.newInstance();
    byte[] rsidr = doc.getDocument().getBody().getPArray()[0].getRsidR();
    byte[] rsidrdefault = doc.getDocument().getBody().getPArray()[0].getRsidRDefault();
    p.setRsidP(rsidr);
    p.setRsidRDefault(rsidrdefault);
    CTPPr pPr = p.addNewPPr();
    pPr.addNewPStyle().setVal("Header");
    // start watermark paragraph
    CTR r = p.addNewR();
    CTRPr rPr = r.addNewRPr();
    rPr.addNewNoProof();
    CTPicture pict = r.addNewPict();
View Full Code Here

        XWPFParagraph p = doc.createParagraph();

        assertEquals(STBorder.NONE.intValue(), p.getBorderTop().getValue());

        CTP ctp = p.getCTP();
        CTPPr ppr = ctp.getPPr()== null? ctp.addNewPPr() : ctp.getPPr();

        //bordi
        CTPBdr bdr = ppr.addNewPBdr();
        CTBorder borderTop = bdr.addNewTop();
        borderTop.setVal(STBorder.DOUBLE);
        bdr.setTop(borderTop);

        assertEquals(Borders.DOUBLE, p.getBorderTop());
View Full Code Here

        XWPFParagraph p = doc.createParagraph();

        assertEquals(STJc.LEFT.intValue(), p.getAlignment().getValue());

        CTP ctp = p.getCTP();
        CTPPr ppr = ctp.getPPr()== null? ctp.addNewPPr() : ctp.getPPr();

        CTJc align = ppr.addNewJc();
        align.setVal(STJc.CENTER);
        assertEquals(ParagraphAlignment.CENTER, p.getAlignment());

        p.setAlignment(ParagraphAlignment.BOTH);
        assertEquals(STJc.BOTH, ppr.getJc().getVal());
    }
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.