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

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


     * add a new table to the end of the footnote
     * @param table
     * @return the added XWPFTable
     */
    public XWPFTable addNewTbl(CTTbl table) {
        CTTbl newTable = ctFtnEdn.addNewTbl();
        newTable.set(table);
        XWPFTable xTable = new XWPFTable(newTable, this);
        tables.add(xTable);
        return xTable;
    }
View Full Code Here


        if(isCursorInHdrF(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

        this.ctRun = CTR.Factory.newInstance();
   */
    }

    public void testConstructor() {
  CTTbl ctTable=CTTbl.Factory.newInstance();
  XWPFTable xtab=new XWPFTable(ctTable);
  assertNotNull(xtab);
  assertEquals(1,ctTable.sizeOfTrArray());
  assertEquals(1,ctTable.getTrArray(0).sizeOfTcArray());
  assertNotNull(ctTable.getTrArray(0).getTcArray(0).getPArray(0));
 
  ctTable=CTTbl.Factory.newInstance();
  xtab=new XWPFTable(ctTable, 3,2);
  assertNotNull(xtab);
  assertEquals(3,ctTable.sizeOfTrArray());
  assertEquals(2,ctTable.getTrArray(0).sizeOfTcArray());
  assertNotNull(ctTable.getTrArray(0).getTcArray(0).getPArray(0));
    }       
View Full Code Here

  assertNotNull(ctTable.getTrArray(0).getTcArray(0).getPArray(0));
    }       
   
   
    public void testGetText(){
  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!");
View Full Code Here

      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(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(CTTbl.Factory.newInstance());
      assertEquals(1,xtab.getCTTbl().getTrArray(0).sizeOfTcArray());
    }
View Full Code Here

      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(table);
 
  assertEquals(1000,xtab.getWidth());
 
  xtab.setWidth(100);
  assertEquals(100,table.getTblPr().getTblW().getW().intValue());
    }
View Full Code Here

        this.ctRun = CTR.Factory.newInstance();
   */
    }

    public void testConstructor() {
  CTTbl ctTable=CTTbl.Factory.newInstance();
  XWPFTable xtab=new XWPFTable(null, ctTable);
  assertNotNull(xtab);
  assertEquals(1,ctTable.sizeOfTrArray());
  assertEquals(1,ctTable.getTrArray(0).sizeOfTcArray());
  assertNotNull(ctTable.getTrArray(0).getTcArray(0).getPArray(0));
 
  ctTable=CTTbl.Factory.newInstance();
  xtab=new XWPFTable(null, ctTable, 3,2);
  assertNotNull(xtab);
  assertEquals(3,ctTable.sizeOfTrArray());
  assertEquals(2,ctTable.getTrArray(0).sizeOfTcArray());
  assertNotNull(ctTable.getTrArray(0).getTcArray(0).getPArray(0));
    }       
View Full Code Here

  assertNotNull(ctTable.getTrArray(0).getTcArray(0).getPArray(0));
    }       
   
   
    public void testGetText(){
  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!");
View Full Code Here

      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

      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

TOP

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

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.