Examples of CTTbl


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

        assertEquals("finally I can write!\n", xtab.getText());
    }


    public void testCreateRow() {
        CTTbl table = CTTbl.Factory.newInstance();
        CTRow r1 = table.addNewTr();
        r1.addNewTc().addNewP();
        r1.addNewTc().addNewP();
        CTRow r2 = table.addNewTr();
        r2.addNewTc().addNewP();
        r2.addNewTc().addNewP();
        CTRow r3 = table.addNewTr();
        r3.addNewTc().addNewP();
        r3.addNewTc().addNewP();

        XWPFTable xtab = new XWPFTable(null, table);
        assertEquals(3, xtab.getNumberOfRows());
        assertNotNull(xtab.getRow(2));

        //add a new row
        xtab.createRow();

        //check number of cols
        assertEquals(2, table.getTrArray(0).sizeOfTcArray());

        //check creation of first row
        xtab = new XWPFTable(null, CTTbl.Factory.newInstance());
        assertEquals(1, xtab.getCTTbl().getTrArray(0).sizeOfTcArray());
    }
View Full Code Here

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

        assertEquals(1, xtab.getCTTbl().getTrArray(0).sizeOfTcArray());
    }


    public void testSetGetWidth() {
        CTTbl table = CTTbl.Factory.newInstance();
        table.addNewTblPr().addNewTblW().setW(new BigInteger("1000"));

        XWPFTable xtab = new XWPFTable(null, table);

        assertEquals(1000, xtab.getWidth());

        xtab.setWidth(100);
        assertEquals(100, table.getTblPr().getTblW().getW().intValue());
    }
View Full Code Here

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

        xtab.setWidth(100);
        assertEquals(100, table.getTblPr().getTblW().getW().intValue());
    }

    public void testSetGetHeight() {
        CTTbl table = CTTbl.Factory.newInstance();

        XWPFTable xtab = new XWPFTable(null, table);
        XWPFTableRow row = xtab.createRow();
        row.setHeight(20);
        assertEquals(20, row.getHeight());
View Full Code Here

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

  if(isCursorInTableCell(cursor)){
      String uri = CTTbl.type.getName().getNamespaceURI();
      String localPart = "tbl";
      cursor.beginElement(localPart,uri);
      cursor.toParent();
      CTTbl t = (CTTbl)cursor.getObject();
      XWPFTable newT = new XWPFTable(t, this);
      cursor.removeXmlContents();
      XmlObject o = null;
      while(!(o instanceof CTTbl)&&(cursor.toPrevSibling())){
    o = cursor.getObject();
      }
      if(!(o instanceof CTTbl)){
    tables.add(0, newT);
      }
      else{
    int pos = tables.indexOf(getTable((CTTbl)o))+1;
    tables.add(pos,newT);
      }
      int i=0;
      cursor = t.newCursor();
      while(cursor.toPrevSibling()){
    o =cursor.getObject();
    if(o instanceof CTP || o instanceof CTTbl)
        i++;
      }
      bodyElements.add(i, newT);
      cursor = t.newCursor();
      cursor.toEndToken();
      return newT;
  }
  return null;
    }
View Full Code Here

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

     */
    public void insertTable(int pos, XWPFTable table) {
  bodyElements.add(pos, table);
  int i;
  for (i = 0; i < ctTc.getTblList().size(); i++) {
      CTTbl tbl = ctTc.getTblArray(i);
      if(tbl == table.getCTTbl()){
    break;
      }
  }
  tables.add(i, table);
View Full Code Here

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

  o = cursor.getObject();
  cursor.dispose();
  if(! (o instanceof CTTbl)){
      return null;
  }
  CTTbl tbl = (CTTbl) o;
  XWPFTable table = getTable(tbl);
  if(table == null){
      return null;
  }
  XWPFTableRow tableRow = table.getRow(row);
View Full Code Here

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

        if (isCursorInBody(cursor)) {
            String uri = CTTbl.type.getName().getNamespaceURI();
            String localPart = "tbl";
            cursor.beginElement(localPart, uri);
            cursor.toParent();
            CTTbl t = (CTTbl) cursor.getObject();
            XWPFTable newT = new XWPFTable(t, this);
            XmlObject o = null;
            while (!(o instanceof CTTbl) && (cursor.toPrevSibling())) {
                o = cursor.getObject();
            }
            if (!(o instanceof CTTbl)) {
                tables.add(0, newT);
            } else {
                int pos = tables.indexOf(getTable((CTTbl) o)) + 1;
                tables.add(pos, newT);
            }
            int i = 0;
            XmlCursor tableCursor = t.newCursor();
            try {
                cursor.toCursor(tableCursor);
                while (cursor.toPrevSibling()) {
                    o = cursor.getObject();
                    if (o instanceof CTP || o instanceof CTTbl)
View Full Code Here

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

    @Override
    public void insertTable(int pos, XWPFTable table) {
        bodyElements.add(pos, table);
        int i;
        for (i = 0; i < ctDocument.getBody().getTblList().size(); i++) {
            CTTbl tbl = ctDocument.getBody().getTblArray(i);
            if (tbl == table.getCTTbl()) {
                break;
            }
        }
        tables.add(i, table);
View Full Code Here

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

        o = cursor.getObject();
        cursor.dispose();
        if(! (o instanceof CTTbl)){
            return null;
        }
        CTTbl tbl = (CTTbl) o;
        XWPFTable table = getTable(tbl);
        if(table == null){
            return null;
        }
        XWPFTableRow tableRow = table.getRow(row);
View Full Code Here

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

    STVerticalJc stVjc = STVerticalJc.Factory.newInstance();
    assertNotNull(stVjc);

      // create a table
        XWPFDocument doc = new XWPFDocument();
      CTTbl ctTable = CTTbl.Factory.newInstance();
        XWPFTable table = new XWPFTable(ctTable, doc);
        // table has a single row by default; grab it
        XWPFTableRow tr = table.getRow(0);
        assertNotNull(tr);
        // row has a single cell by default; grab it
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.