public static void MoveRangeByOffset(this ISheet sheet, CellRange range, CellOffset offset) { sheet.CopyRangeByOffset(range, offset); var endRowIndex = range.StartLocation.RowIndex + offset.OffsetY; var endColumnIndex = range.StartLocation.ColumnIndex + offset.OffsetX; for (var rowIndex = range.StartLocation.RowIndex; rowIndex < endRowIndex; rowIndex++) { var row = sheet.GetRow(rowIndex); if (row == null) { continue; } for (var columnIndex = range.StartLocation.ColumnIndex; columnIndex <= range.EndLocation.ColumnIndex; columnIndex++) { var cell = row.GetCell(columnIndex); if (cell == null) { continue; } row.RemoveCell(cell); } } for (var columnIndex = range.StartLocation.ColumnIndex; columnIndex < endColumnIndex; columnIndex++) { for (var rowIndex = range.StartLocation.RowIndex; rowIndex <= range.EndLocation.RowIndex; rowIndex++) { var row = sheet.GetRow(rowIndex); if (row == null) { continue; } var cell = row.GetCell(columnIndex); if (cell == null) { continue; } row.RemoveCell(cell); } } }