return;
}
// iterate rows
for (int rowC = 0; rowC < ctTbl.sizeOfTrArray(); rowC++) {
XWPFTableRow tabRow = getTable().getRow(rowC);
CTRow ctRow = tabRow.getCtRow();
// if it is specified in meta tag get reference column
// otherwise it is the last column of row
int tempCellC = tabRow.getTableCells().size() - 1;
if (dynamicColumnIndex != -1) {
tempCellC = dynamicColumnIndex;
}
// we need to backup static columns of cell
// TODO what will we do if colstart index bigger than column index?
if (tempCellC > tabRow.getCtRow().sizeOfTcArray()) {
continue;
}
// create dynamic columns
int dynamicColumnAddIndex = 0;
try {
dynamicColumnAddIndex = getDynamicColumnAddIndex(tabRow, dynamicColumnIndex);
} catch (OrcaReportRendererException e) {
e.printStackTrace();
}
//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);
}
}
}