public XSLFTableRow addRow(){ CTTableRow tr = _table.addNewTr(); XSLFTableRow row = new XSLFTableRow(tr, this); // default height is 20 points row.setHeight(20.0); _rows.add(row); updateRowColIndexes(); return row; }
/*package*/ XSLFTable(CTGraphicalObjectFrame shape, XSLFSheet sheet){ super(shape, sheet); CTGraphicalObjectData god = shape.getGraphic().getGraphicData(); XmlCursor xc = god.newCursor(); try { if (!xc.toChild(XSLFRelation.NS_DRAWINGML, "tbl")) { throw new IllegalStateException("a:tbl element was not found in\n " + god); } XmlObject xo = xc.getObject(); // Pesky XmlBeans bug - see Bugzilla #49934 // it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas if (xo instanceof XmlAnyTypeImpl){ String errStr = "Schemas (*.xsb) for CTTable can't be loaded - usually this happens when OSGI " + "loading is used and the thread context classloader has no reference to " + "the xmlbeans classes" ; throw new IllegalStateException(errStr); } _table = (CTTable)xo; } finally { xc.dispose(); } _rows = new ArrayList<>(_table.sizeOfTrArray()); for(CTTableRow row : _table.getTrList()) { _rows.add(new XSLFTableRow(row, this)); } updateRowColIndexes(); }
public XSLFTableCell addCell(){ CTTableCell c = _row.addNewTc(); c.set(XSLFTableCell.prototype()); XSLFTableCell cell = new XSLFTableCell(c, _table); _cells.add(cell); if(_table.getNumberOfColumns() < _row.sizeOfTcArray()) { _table.getCTTable().getTblGrid().addNewGridCol().setW(Units.toEMU(100.0)); } _table.updateRowColIndexes(); return cell; }
public XSLFTableRow addRow(){ CTTableRow tr = _table.addNewTr(); XSLFTableRow row = new XSLFTableRow(tr, this); // default height is 20 points row.setHeight(20.0); _rows.add(row); updateRowColIndexes(); return row; }
/*package*/ XSLFTable(CTGraphicalObjectFrame shape, XSLFSheet sheet){ super(shape, sheet); CTGraphicalObjectData god = shape.getGraphic().getGraphicData(); XmlCursor xc = god.newCursor(); try { if (!xc.toChild(XSLFRelation.NS_DRAWINGML, "tbl")) { throw new IllegalStateException("a:tbl element was not found in\n " + god); } XmlObject xo = xc.getObject(); // Pesky XmlBeans bug - see Bugzilla #49934 // it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas if (xo instanceof XmlAnyTypeImpl){ String errStr = "Schemas (*.xsb) for CTTable can't be loaded - usually this happens when OSGI " + "loading is used and the thread context classloader has no reference to " + "the xmlbeans classes" ; throw new IllegalStateException(errStr); } _table = (CTTable)xo; } finally { xc.dispose(); } _rows = new ArrayList<>(_table.sizeOfTrArray()); for(CTTableRow row : _table.getTrList()) { _rows.add(new XSLFTableRow(row, this)); } updateRowColIndexes(); }
public XSLFTableCell addCell(){ CTTableCell c = _row.addNewTc(); c.set(XSLFTableCell.prototype()); XSLFTableCell cell = new XSLFTableCell(c, _table); _cells.add(cell); if(_table.getNumberOfColumns() < _row.sizeOfTcArray()) { _table.getCTTable().getTblGrid().addNewGridCol().setW(Units.toEMU(100.0)); } _table.updateRowColIndexes(); return cell; }