xiejun
2023-08-23 205056bc17023dd44e6d262cfe78b6e146ee2f20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* XLS ranges enforced */
function shift_cell_xls(cell, tgt) {
    if(tgt.s) {
        if(cell.cRel) cell.c += tgt.s.c;
        if(cell.rRel) cell.r += tgt.s.r;
    } else {
        cell.c += tgt.c;
        cell.r += tgt.r;
    }
    cell.cRel = cell.rRel = 0;
    while(cell.c >= 0x100) cell.c -= 0x100;
    while(cell.r >= 0x10000) cell.r -= 0x10000;
    return cell;
}
 
function shift_range_xls(cell, range) {
    cell.s = shift_cell_xls(cell.s, range.s);
    cell.e = shift_cell_xls(cell.e, range.s);
    return cell;
}