Home
last modified time | relevance | path

Searched hist:"577 fe179" (Results 1 – 3 of 3) sorted by relevance

/trunk/test/testuno/data/uno/sc/fvt/
H A DBug81233ColumnZReference.xml577fe179 Wed Jan 11 17:47:12 UTC 2023 Damjan Jovanovic <damjan@apache.org> Our XSLT-based MS Office 2003 SpreadsheetML format import filter, when doing
conversion from R1C1 style column references to our A1 style references, had a
bug where it was treating the column value as 0-based, and dividing by 26 to
find the 1st letter and taking the remainder when divided by 26 for the second
letter. Those numbers are then each converted to a letter [0 = nothing,
1 = "A", 2 = "B", ..., 26 = "Z"].

However since R1C1 is 1-based, and not 0-based, this breaks for column numbers
which are multiples of 26, as 26 mod 26 = 0, so the least significant digit is
converted to nothing while the most significant digit gets incremented too
early.

Fix this by converting the column number to 0-based by subtracting 1 before
calculation, then adding 1 to the least significant digit afterwards.

Also the fact we have 2 letters limited us to a maximum of 26^2 = 676 columns,
after which column references would wrap around. Fix this too, by adding a 3rd
letter, which lets us address a maximum of 17576 columns.

Add a sample file to our unit tests.

Found by: alex dot plantema at xs4all dot nl
Patch by: me
/trunk/main/filter/source/xslt/import/spreadsheetml/
H A Dspreadsheetml2ooo.xsldiff 577fe179 Wed Jan 11 17:47:12 UTC 2023 Damjan Jovanovic <damjan@apache.org> Our XSLT-based MS Office 2003 SpreadsheetML format import filter, when doing
conversion from R1C1 style column references to our A1 style references, had a
bug where it was treating the column value as 0-based, and dividing by 26 to
find the 1st letter and taking the remainder when divided by 26 for the second
letter. Those numbers are then each converted to a letter [0 = nothing,
1 = "A", 2 = "B", ..., 26 = "Z"].

However since R1C1 is 1-based, and not 0-based, this breaks for column numbers
which are multiples of 26, as 26 mod 26 = 0, so the least significant digit is
converted to nothing while the most significant digit gets incremented too
early.

Fix this by converting the column number to 0-based by subtracting 1 before
calculation, then adding 1 to the least significant digit afterwards.

Also the fact we have 2 letters limited us to a maximum of 26^2 = 676 columns,
after which column references would wrap around. Fix this too, by adding a 3rd
letter, which lets us address a maximum of 17576 columns.

Add a sample file to our unit tests.

Found by: alex dot plantema at xs4all dot nl
Patch by: me
/trunk/test/testuno/source/fvt/uno/sc/formula/
H A DTestFormulaDocs.javadiff 577fe179 Wed Jan 11 17:47:12 UTC 2023 Damjan Jovanovic <damjan@apache.org> Our XSLT-based MS Office 2003 SpreadsheetML format import filter, when doing
conversion from R1C1 style column references to our A1 style references, had a
bug where it was treating the column value as 0-based, and dividing by 26 to
find the 1st letter and taking the remainder when divided by 26 for the second
letter. Those numbers are then each converted to a letter [0 = nothing,
1 = "A", 2 = "B", ..., 26 = "Z"].

However since R1C1 is 1-based, and not 0-based, this breaks for column numbers
which are multiples of 26, as 26 mod 26 = 0, so the least significant digit is
converted to nothing while the most significant digit gets incremented too
early.

Fix this by converting the column number to 0-based by subtracting 1 before
calculation, then adding 1 to the least significant digit afterwards.

Also the fact we have 2 letters limited us to a maximum of 26^2 = 676 columns,
after which column references would wrap around. Fix this too, by adding a 3rd
letter, which lets us address a maximum of 17576 columns.

Add a sample file to our unit tests.

Found by: alex dot plantema at xs4all dot nl
Patch by: me

Completed in 16 milliseconds