}
refColumn = getColumnByIndex(index);
positionCol = refColumn;
TableTableColumnElement newColumnEle = (TableTableColumnElement) refColumn.getOdfElement().cloneNode(true);
newColumnEle.setTableNumberColumnsRepeatedAttribute(new Integer(columnCount));
mTableElement.insertBefore(newColumnEle, positionCol.getOdfElement());
for (int i = 0; i < columnCount; i++) {
list.add(getColumnInstance(newColumnEle, i));
}
return list;
}
//1. insert the cell
int iRowCount = getRowCount();
for (int i = iRowCount - 1; i >= 0;) {
OdfTableRow row = getRowByIndex(i);
OdfTableCell refCell = row.getCellByIndex(index - 1);
OdfTableCell positionCell = null;
positionCell = row.getCellByIndex(index);
row.insertCellBefore(refCell, positionCell, columnCount);
i = i - row.getRowsRepeatedNumber();
}
refColumn = getColumnByIndex(index - 1);
positionCol = getColumnByIndex(index);
//2. insert a <table:table-column>
if (refColumn.getOdfElement() == positionCol.getOdfElement()) {
TableTableColumnElement column = refColumn.getOdfElement();
int repeatedCount = getColumnInstance(column, 0).getColumnsRepeatedNumber();
getColumnInstance(column, 0).setColumnsRepeatedNumber((repeatedCount + columnCount));
TableTableColumnElement columnEle = positionCol.getOdfElement();
OdfTableColumn startCol = getColumnInstance(positionCol.getOdfElement(), 0);
for (int i = repeatedCount + columnCount - 1; i >= columnCount + (index - startCol.getColumnIndex()); i--) {
updateColumnRepository(columnEle, i - columnCount, columnEle, i);
}
for (int i = 0; i < columnCount; i++) {
list.add(getColumnInstance(column, refColumn.mnRepeatedIndex + 1 + i));
}
} else {
TableTableColumnElement newColumnEle = (TableTableColumnElement) refColumn.getOdfElement().cloneNode(true);
newColumnEle.setTableNumberColumnsRepeatedAttribute(new Integer(columnCount));
mTableElement.insertBefore(newColumnEle, positionCol.getOdfElement());
for (int i = 0; i < columnCount; i++) {
list.add(getColumnInstance(newColumnEle, i));
}