Ejemplo n.º 1
0
 /**
  * get the TableCell which belongs to the TableCell
  *
  * @param cell
  */
 public XWPFTableCell getTableCell(CTTc cell) {
   XmlCursor cursor = cell.newCursor();
   cursor.toParent();
   XmlObject o = cursor.getObject();
   if (!(o instanceof CTRow)) {
     return null;
   }
   CTRow row = (CTRow) o;
   cursor.toParent();
   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);
   if (row == null) {
     return null;
   }
   return tableRow.getTableCell(cell);
 }
  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());
  }