Add a paragraph to the cell.
XWPFTableRow rowOne = table.getRow(0);
XWPFParagraph paragraph = rowOne.getCell(0).addParagraph();
setRun(paragraph.createRun() , "Calibre LIght" , 10, "2b5079" , "Some string" , false, false);
private static void setRun (XWPFRun run , String fontFamily , int fontSize , String colorRGB , String text , boolean bold , boolean addBreak) {
run.setFontFamily(fontFamily);
run.setFontSize(fontSize);
run.setColor(colorRGB);
run.setText(text);
run.setBold(bold);
if (addBreak) run.addBreak();
}
This usually adds another paragraph to the cell, but the cell already has one. Therefore, first delete the paragraph in the cell, and then add a new one, otherwise the result will be an empty line before the new paragraph.
rowOne.getCell(0).removeParagraph(0);