//check if row needs to be iterated or stretched.
if (tabRow.getCell(dynamicColumnAddIndex).getCTTc().getTcPr().isSetGridSpan()) {
BigInteger gridSpanVal = tabRow.getCell(dynamicColumnAddIndex).getCTTc().getTcPr().getGridSpan().getVal();
tabRow.getCell(dynamicColumnAddIndex).getCTTc().getTcPr().getGridSpan().setVal(gridSpanVal.add(BigInteger.valueOf(columnDataList.size() - 1)));
} else {
XWPFTableCell tempCell = tabRow.getCell(dynamicColumnAddIndex);
//add new cells to the row.
for (int colC = 0; colC < columnDataList.size() - 1; colC++) {
XWPFTableCell tableCell = new XWPFTableCell(ctRow.insertNewTc(dynamicColumnAddIndex + colC), tabRow, getTable().getBody());
tabRow.getTableCells().add(dynamicColumnAddIndex + colC, tableCell);
DocXEngine.copyCell(tempCell, tableCell);
}
}
}