if(textTableManagement.getTextTables().length == 1 && textTableManagement.getFirstTextTable().getRowCount() + count < maxRowsInTable) {
textTableManagement.getFirstTextTable().addRow(index,count);
return;
}
IETextTableCellRange textTableCellRange = getCellRange(0,index,columnCount-1,getRowCount()-1);
ITextTable textTable = textTableManagement.getLastTextTable();
IDestinationPosition destinationPosition = new DestinationPosition(textTable);
try {
ETextTableCellRange tableCellRange = (ETextTableCellRange)textTableCellRange.getCloneService().cloneToPosition(destinationPosition,null).getClonedObject();
ITextTableCellRange[] textTableCellRanges = tableCellRange.getRanges();
int tableNumber = getTableNumber(index);
ITextTable table = textTableManagement.getTextTable(tableNumber);
int rowCount = table.getRowCount()-1;
int rowIndex = getRowIndexInTable(tableNumber,index);
removeTables(tableNumber+1,textTableManagement.getTextTables().length-tableNumber-1);
ITextTableCellRange textTableCellRangeClone = table.getCellRange(0,rowIndex,columnCount-1,rowIndex);
int help = rowIndex + count - (rowCount+1);
if(help < 0) {
for(int i = rowIndex; i <= count; i++) {
ITextTableCellRange cellRange = table.getCellRange(0,i,columnCount-1,i);
destinationPosition = new DestinationPosition(cellRange);
textTableCellRangeClone.getCloneService().cloneToPosition(destinationPosition,null);
}
IETextTableCellRange cellRange = getCellRange(0,index,columnCount-1,index+count-1);
clearTableRange(cellRange);
table.removeRows(rowIndex+count,rowCount-(rowIndex+count)+1);
}
else {
for(int i = rowIndex; i <= rowCount; i++) {
ITextTableCellRange cellRange = table.getCellRange(0,i,columnCount-1,i);
destinationPosition = new DestinationPosition(cellRange);
textTableCellRangeClone.getCloneService().cloneToPosition(destinationPosition,null);
}
IETextTableCellRange cellRange = getCellRange(0,index,columnCount-1,index + (rowCount-rowIndex));
clearTableRange(cellRange);