git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1875744 13f79535-47bb-0310-9956-ffa450edef68tags/before_ooxml_3rd_edition
@@ -427,8 +427,7 @@ public class XWPFTableCell implements IBody, ICell { | |||
} | |||
public void setText(String text) { | |||
CTP ctP = (ctTc.sizeOfPArray() == 0) ? ctTc.addNewP() : ctTc.getPArray(0); | |||
XWPFParagraph par = new XWPFParagraph(ctP, this); | |||
XWPFParagraph par = (paragraphs.size() == 0) ? addParagraph() : paragraphs.get(0); | |||
par.createRun().setText(text); | |||
} | |||
@@ -149,4 +149,18 @@ public class TestXWPFTableCell { | |||
assertEquals(2500, cell.getWidth()); | |||
doc.close(); | |||
} | |||
@Test | |||
public void testBug63624() throws Exception { | |||
XWPFDocument doc = new XWPFDocument(); | |||
XWPFTable table = doc.createTable(1, 1); | |||
XWPFTableRow row = table.getRow(0); | |||
XWPFTableCell cell = row.getCell(0); | |||
String expected = "this must not be empty"; | |||
cell.setText(expected); | |||
String actual = cell.getText(); | |||
assertEquals(expected, actual); | |||
doc.close(); | |||
} | |||
} |