mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
CTRow removes tc when row removes cell
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1881354 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b00ca445b2
commit
3644bb9094
@ -74,6 +74,7 @@ public class XWPFTableRow {
|
||||
public void removeCell(int pos) {
|
||||
if (pos >= 0 && pos < ctRow.sizeOfTcArray()) {
|
||||
tableCells.remove(pos);
|
||||
ctRow.removeTc(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.poi.xwpf.usermodel;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@ -141,6 +142,20 @@ public class TestXWPFTableRow {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveCell() throws IOException {
|
||||
XWPFDocument doc = new XWPFDocument();
|
||||
XWPFTableRow tr = doc.createTable(1, 1).createRow();
|
||||
|
||||
assertEquals(1, tr.getTableCells().size());
|
||||
assertEquals(tr.getTableCells().size(), tr.getCtRow().sizeOfTcArray());
|
||||
|
||||
tr.removeCell(0);
|
||||
assertEquals(0, tr.getTableCells().size());
|
||||
assertEquals(tr.getTableCells().size(), tr.getCtRow().sizeOfTcArray());
|
||||
doc.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBug62174() throws IOException {
|
||||
try (XWPFDocument doc = XWPFTestDataSamples
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user