Skip to content

Column ranges not converted from A1 to RC when exporting in xlml format #1707

@doms3

Description

@doms3

When exporting to the .xlml format, formulas have their cell references in A1 format converted into RC format (i.e. $A$1 becomes R1C1) using the a1_to_rc function.

var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g;
var a1_to_rc =(function(){
return function a1_to_rc(fstr/*:string*/, base/*:CellAddress*/) {
return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) {
var c = decode_col($3) - ($2 ? 0 : base.c);
var r = decode_row($5) - ($4 ? 0 : base.r);
var R = (r == 0 ? "" : !$4 ? "[" + r + "]" : (r+1));
var C = (c == 0 ? "" : !$2 ? "[" + c + "]" : (c+1));
return $1 + "R" + R + "C" + C;
});
};
})();

The function correctly turns references with a letter followed by a number into RC format but does not convert column ranges. As a result the exported sheet either does not have these formulas or they are corrupted.

For example, SUM($A:$A) should become SUM(C1) and SUM($A:$C) should become SUM(C1:C3).

Similarly, SUM($1:$3) should become SUM(R1:R3) in the exported .xlml format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions