Author: abearez Date: Sun Apr 12 00:26:12 2020 New Revision: 1876409 URL: http://svn.apache.org/viewvc?rev=1876409&view=rev Log: Add table row at correct index
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java?rev=1876409&r1=1876408&r2=1876409&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java Sun Apr 12 00:26:12 2020 @@ -153,14 +153,15 @@ public class XSLFTable extends XSLFGraph public XSLFTableRow addRow(){ CTTableRow tr = _table.addNewTr(); - return initializeRow(tr); + XSLFTableRow row = initializeRow(tr); + _rows.add(row); + return row; } private XSLFTableRow initializeRow(CTTableRow tr) { XSLFTableRow row = new XSLFTableRow(tr, this); // default height is 20 points row.setHeight(20.0); - _rows.add(row); for (int i = 0; i < getNumberOfColumns(); i++) { row.addCell(); } @@ -177,7 +178,9 @@ public class XSLFTable extends XSLFGraph throw new IndexOutOfBoundsException("Cannot insert row at " + rowIdx + "; table has only " + getNumberOfRows() + "rows."); } CTTableRow tr = _table.insertNewTr(rowIdx); - return initializeRow(tr); + XSLFTableRow row = initializeRow(tr); + _rows.add(rowIdx, row); + return row; } /** --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org