insertColumn method
Insert column in sheet
at position columnIndex
Implementation
@override
void insertColumn(String sheet, int columnIndex) {
super.insertColumn(sheet, columnIndex);
for (var row in _findRows(_sheets[sheet]!)) {
XmlElement? cell;
var cells = _findCells(row);
var currentIndex = 0; // cells could be empty
for (var currentCell in cells) {
currentIndex = _getCellNumber(currentCell) - 1;
if (currentIndex >= columnIndex) {
cell = currentCell;
break;
}
}
if (cell != null) {
cells
.skipWhile((c) => c != cell)
.forEach((c) => _setCellColNumber(c, _getCellNumber(c) + 1));
}
// Nothing to do if cell == null
}
}