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

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


        return i;
    }

    private CTHdrFtr buildFtr(Enum type, String pStyle, XWPFHeaderFooter wrapper, XWPFParagraph[] pars) {
        //CTHdrFtr ftr = buildHdrFtr(pStyle, pars);        // MB 24 May 2010
        CTHdrFtr ftr = buildHdrFtr(pStyle, pars, wrapper);    // MB 24 May 2010
        setFooterReference(type, wrapper);
        return ftr;
    }
View Full Code Here


        return ftr;
    }

    private CTHdrFtr buildHdr(Enum type, String pStyle, XWPFHeaderFooter wrapper, XWPFParagraph[] pars) {
        //CTHdrFtr hdr = buildHdrFtr(pStyle, pars);        // MB 24 May 2010
        CTHdrFtr hdr = buildHdrFtr(pStyle, pars, wrapper);    // MB 24 May 2010
        setHeaderReference(type, wrapper);
        return hdr;
    }
View Full Code Here

        setHeaderReference(type, wrapper);
        return hdr;
    }

    private CTHdrFtr buildHdrFtr(String pStyle, XWPFParagraph[] paragraphs) {
        CTHdrFtr ftr = CTHdrFtr.Factory.newInstance();
        if (paragraphs != null) {
            for (int i = 0 ; i < paragraphs.length ; i++) {
                CTP p = ftr.addNewP();
                //ftr.setPArray(0, paragraphs[i].getCTP());    // MB 23 May 2010
                ftr.setPArray(i, paragraphs[i].getCTP());     // MB 23 May 2010
            }
        }
        else {
            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();
View Full Code Here

     * it should have recovered the CTHdrFtr object encapsulated within the XWPFHeaderFooter object
     * that had previoulsy been instantiated in the createHeader(int, XWPFParagraph[]) or
     * createFooter(int, XWPFParagraph[]) methods.
     */
    private CTHdrFtr buildHdrFtr(String pStyle, XWPFParagraph[] paragraphs, XWPFHeaderFooter wrapper) {
        CTHdrFtr ftr = wrapper._getHdrFtr();
        if (paragraphs != null) {
            for (int i = 0 ; i < paragraphs.length ; i++) {
                CTP p = ftr.addNewP();
                ftr.setPArray(i, paragraphs[i].getCTP());
            }
        }
        else {
            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();
View Full Code Here

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

        assertEquals(-1, p.getIndentationLeft());

        CTInd ind = ppr.addNewInd();
        ind.setLeft(new BigInteger("10"));
        assertEquals(10, p.getIndentationLeft());

        p.setIndentationLeft(100);
        assertEquals(100, ind.getLeft().intValue());
    }
View Full Code Here

        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

        XWPFParagraph p = doc.createParagraph();

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

        CTOnOff wordWrap = ppr.addNewWordWrap();
        wordWrap.setVal(STOnOff.FALSE);
        assertEquals(false, p.isWordWrap());

        p.setWordWrap(true);
        assertEquals(STOnOff.TRUE, ppr.getWordWrap().getVal());
    }
View Full Code Here

        XWPFParagraph p = doc.createParagraph();

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

        CTOnOff pageBreak = ppr.addNewPageBreakBefore();
        pageBreak.setVal(STOnOff.FALSE);
        assertEquals(false, p.isPageBreak());

        p.setPageBreak(true);
        assertEquals(STOnOff.TRUE, ppr.getPageBreakBefore().getVal());
    }
View Full Code Here

     assertEquals(4, doc.getParagraphs().size());
    
     assertEquals(3, doc.getParagraphPos(3));
      assertEquals(3, doc.getPosOfParagraph(p));

     CTP ctp = p.getCTP();
     XWPFParagraph newP = doc.getParagraph(ctp);
     assertSame(p, newP);
     XmlCursor cursor = doc.getDocument().getBody().getPArray(0).newCursor();
     XWPFParagraph cP = doc.insertNewParagraph(cursor);
     assertSame(cP, doc.getParagraphs().get(0));
View Full Code Here

    public void testGetText() {
        XWPFDocument doc = new XWPFDocument();
        CTTbl table = CTTbl.Factory.newInstance();
        CTRow row = table.addNewTr();
        CTTc cell = row.addNewTc();
        CTP paragraph = cell.addNewP();
        CTR run = paragraph.addNewR();
        CTText text = run.addNewT();
        text.setStringValue("finally I can write!");

        XWPFTable xtab = new XWPFTable(table, doc);
        assertEquals("finally I can write!\n", xtab.getText());
View Full Code Here

TOP

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

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.