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

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


    private void createEmptyTable(CTTbl table) {
        // MINIMUM ELEMENTS FOR A TABLE
        table.addNewTr().addNewTc().addNewP();

        CTTblPr tblpro = table.addNewTblPr();
        tblpro.addNewTblW().setW(new BigInteger("0"));
        tblpro.getTblW().setType(STTblWidth.AUTO);

        // layout
        // tblpro.addNewTblLayout().setType(STTblLayoutType.AUTOFIT);

        // borders
        CTTblBorders borders = tblpro.addNewTblBorders();
        borders.addNewBottom().setVal(STBorder.SINGLE);
        borders.addNewInsideH().setVal(STBorder.SINGLE);
        borders.addNewInsideV().setVal(STBorder.SINGLE);
        borders.addNewLeft().setVal(STBorder.SINGLE);
        borders.addNewRight().setVal(STBorder.SINGLE);
View Full Code Here


    /**
     * @param width
     */
    public void setWidth(int width) {
        CTTblPr tblPr = getTrPr();
        CTTblWidth tblWidth = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr
                .addNewTblW();
        tblWidth.setW(new BigInteger("" + width));
    }
View Full Code Here

    /**
     * @return width value
     */
    public int getWidth() {
        CTTblPr tblPr = getTrPr();
        return tblPr.isSetTblW() ? tblPr.getTblW().getW().intValue() : -1;
    }
View Full Code Here

    /**
     * @param width
     */
    public void setWidth(int width) {
        CTTblPr tblPr = getTrPr();
        CTTblWidth tblWidth = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr
                .addNewTblW();
        tblWidth.setW(new BigInteger("" + width));
    }
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);
View Full Code Here

        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

        XWPFParagraph p = doc.createParagraph();

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

        CTTextAlignment txtAlign = ppr.addNewTextAlignment();
        txtAlign.setVal(STTextAlignment.CENTER);
        assertEquals(TextAlignment.CENTER, p.getVerticalAlignment());

        p.setVerticalAlignment(TextAlignment.BOTTOM);
        assertEquals(STTextAlignment.BOTTOM, ppr.getTextAlignment().getVal());
    }
View Full Code Here

   
    public XWPFFooter createFooter(Enum type, XWPFParagraph[] pars) throws IOException {
      XWPFRelation relation = XWPFRelation.FOOTER;
      String pStyle = "Footer";
      int i = getRelationIndex(relation);
      FtrDocument ftrDoc = FtrDocument.Factory.newInstance();
      XWPFFooter wrapper = (XWPFFooter)doc.createRelationship(relation, XWPFFactory.getInstance(), i);

      CTHdrFtr ftr = buildFtr(type, pStyle, wrapper, pars);
      wrapper.setHeaderFooter(ftr);
     
      OutputStream outputStream = wrapper.getPackagePart().getOutputStream();
      ftrDoc.setFtr(ftr);
     
        XmlOptions xmlOptions = commit(wrapper);

      assignFooter(wrapper, type);
    ftrDoc.save(outputStream, xmlOptions);
    outputStream.close();
      return wrapper;
    }
View Full Code Here

   
    public XWPFFooter createFooter(Enum type, XWPFParagraph[] pars) throws IOException {
      XWPFRelation relation = XWPFRelation.FOOTER;
      String pStyle = "Footer";
      int i = getRelationIndex(relation);
      FtrDocument ftrDoc = FtrDocument.Factory.newInstance();
      XWPFFooter wrapper = (XWPFFooter)doc.createRelationship(relation, XWPFFactory.getInstance(), i);

      CTHdrFtr ftr = buildFtr(type, pStyle, wrapper, pars);
     
      OutputStream outputStream = wrapper.getPackagePart().getOutputStream();
      ftrDoc.setFtr(ftr);
     
        XmlOptions xmlOptions = commit(wrapper);

      assignFooter(wrapper, type);
    ftrDoc.save(outputStream, xmlOptions);
    outputStream.close();
      return wrapper;
    }
View Full Code Here

    }

    @Override 
    protected void onDocumentRead() throws IOException{
        super.onDocumentRead();
        FtrDocument ftrDocument = null;
        InputStream is;
        try {
            is = getPackagePart().getInputStream();
            ftrDocument = FtrDocument.Factory.parse(is);
            headerFooter = ftrDocument.getFtr();
            // parse the document with cursor and add
            // the XmlObject to its lists
            XmlCursor cursor = headerFooter.newCursor();
            cursor.selectPath("./*");
            while (cursor.toNextSelection()) {
View Full Code Here

TOP

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

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.