コード例 #1
0
def compute_offset(host_address, client_address):
    '''
    Returns the absolute difference between two addresses
    '''
    host_col, host_row = address2index(host_address)
    client_col, client_row = address2index(client_address)

    column_offset = client_col - host_col
    row_offset = client_row - host_row

    return tuple((column_offset, row_offset))
コード例 #2
0
def compute_offset(host_address, client_address):
    '''
    Returns the absolute difference between two addresses
    '''
    host_col, host_row = address2index(host_address)
    client_col, client_row = address2index(client_address)

    column_offset = client_col - host_col
    row_offset = client_row - host_row

    return tuple((column_offset, row_offset))
コード例 #3
0
def offset_cell(address, offset):
    new_formula = []
    if check_address(address, "$") == False:
        formula_range = address2index(address)
        col, row = map(sum, zip(formula_range, offset))
        new_formula = index2addres(col, row)
    else:
        col, row = split_address(address)
        if check_address(col, "$") == False:
            # Column is not absolute address
            colnum = col2num(col)
            col = num2col(colnum + offset[0])
        if check_address(row, "$") == False:
            # Row is not absolute address
            row = row + offset[1]
        new_formula = "".join([col, row])
    return new_formula
コード例 #4
0
def offset_cell(address, offset):
    new_formula = []
    if check_address(address, "$") == False:
        formula_range = address2index(address)
        col, row = map(sum, zip(formula_range, offset))
        new_formula = index2addres(col, row)
    else:
        col, row = split_address(address)
        if check_address(col, "$") == False:
            # Column is not absolute address
            colnum = col2num(col)
            col = num2col(colnum + offset[0])
        if check_address(row, "$") == False:
            # Row is not absolute address
            row = row + offset[1]
        new_formula = "".join([col, row])
    return new_formula