Forum > FPSpreadsheet

Bugs. Range is not copied correctly

(1/2) > >>

veb86:
Hello! The bug is as follows:
When copying cells that contain a range of type SUM($A$1:A1), the range is broken; the output is SUM($A$1), but should be SUM($A$1:A2).
If we write: SUM($A$1:A2), we get SUM($A$1:A2), but it should have been SUM($A$1:A3).

The rules for copying ranges have been violated. Try copying the formulas into Excel yourself and you will see the difference in results

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    b.Options := [boReadFormulas];    b.ReadFromFile('d:\test1\start.xlsx', sfOOXML);    sh := b.GetFirstWorksheet;      sh.CopyCell(0,1,1,1,b.GetFirstWorksheet);    sh.CopyCell(0,2,1,2,b.GetFirstWorksheet);    sh.CopyCell(0,3,1,3,b.GetFirstWorksheet);        sh.CalcFormulas;     b.WriteToFile('d:\test1\res.xlsx', sfOOXML, true);    

wp:
Please test the new commit in ccr.

veb86:

--- Quote from: wp on July 04, 2024, 07:13:33 pm ---Please test the new commit in ccr.

--- End quote ---
I immediately see the bug.
Cell C1 - SUM($A$1:A1), after saving it became SUM($A$1)

In the XML file (4.xlsx) the entry for this cell is as follows:
<c r="C1"><f>SUM($A$1:A1)</f><v>1</v></c>

This bug has no problems in working correctly, but this bug would be better fixed. It can ruin an existing Excel file and the ability to correctly copy cells will disappear.

I'll keep testing. I'll prepare my code for larger calculations soon.

Thank you very much for fixing the bugs!!!

wp:
Found code in regeneration of string formula by parser which collapses a cell range to a single cell when both range ends are equal (A1:A1 --> A1). Fix might have side-effects somewhere, unit tests do not detect anything, though.

Zvoni:

--- Quote from: wp on July 05, 2024, 01:07:36 pm ---Found code in regeneration of string formula by parser which collapses a cell range to a single cell when both range ends are equal (A1:A1 --> A1). Fix might have side-effects somewhere, unit tests do not detect anything, though.

--- End quote ---
Having not tested anything: Did you account for a Range like "A:A" (Whole column A)?
and in TS special case: Range("$A$1:A1") <> Range("A1:A1")

Navigation

[0] Message Index

[#] Next page

Go to full version