mirror of https://github.com/apache/poi.git
Add table row at correct index
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1876409 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
50d52bf828
commit
f7b4edd27e
|
@ -153,14 +153,15 @@ public class XSLFTable extends XSLFGraphicFrame implements Iterable<XSLFTableRow
|
||||||
|
|
||||||
public XSLFTableRow addRow(){
|
public XSLFTableRow addRow(){
|
||||||
CTTableRow tr = _table.addNewTr();
|
CTTableRow tr = _table.addNewTr();
|
||||||
return initializeRow(tr);
|
XSLFTableRow row = initializeRow(tr);
|
||||||
|
_rows.add(row);
|
||||||
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
private XSLFTableRow initializeRow(CTTableRow tr) {
|
private XSLFTableRow initializeRow(CTTableRow tr) {
|
||||||
XSLFTableRow row = new XSLFTableRow(tr, this);
|
XSLFTableRow row = new XSLFTableRow(tr, this);
|
||||||
// default height is 20 points
|
// default height is 20 points
|
||||||
row.setHeight(20.0);
|
row.setHeight(20.0);
|
||||||
_rows.add(row);
|
|
||||||
for (int i = 0; i < getNumberOfColumns(); i++) {
|
for (int i = 0; i < getNumberOfColumns(); i++) {
|
||||||
row.addCell();
|
row.addCell();
|
||||||
}
|
}
|
||||||
|
@ -177,7 +178,9 @@ public class XSLFTable extends XSLFGraphicFrame implements Iterable<XSLFTableRow
|
||||||
throw new IndexOutOfBoundsException("Cannot insert row at " + rowIdx + "; table has only " + getNumberOfRows() + "rows.");
|
throw new IndexOutOfBoundsException("Cannot insert row at " + rowIdx + "; table has only " + getNumberOfRows() + "rows.");
|
||||||
}
|
}
|
||||||
CTTableRow tr = _table.insertNewTr(rowIdx);
|
CTTableRow tr = _table.insertNewTr(rowIdx);
|
||||||
return initializeRow(tr);
|
XSLFTableRow row = initializeRow(tr);
|
||||||
|
_rows.add(rowIdx, row);
|
||||||
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue