https://bugs.documentfoundation.org/show_bug.cgi?id=47479

Oleg <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |---

--- Comment #12 from Oleg <[email protected]> ---
Below is code that explains the problem that occurs when deleting cells with
the RemoveRange(RangeAddress, com.sun.star.sheet.CellDeleteMode.UP) method and
then accessing the cells with the GetCellRangeByName() or
GetCellRangeByPosition() or GetCellByPosition() method.

Response from system:
Basic runtime error.
An exception occurred
Type: com.sun.star.uno.RuntimeException
Message:.

Dim oSheet1 As Object
Dim oRange As Object
Dim oRange2 As Object

oSheet1 = ThisComponent.Sheets(0)

' Example 1:
oRange = oSheet1.GetCellRangeByName("A15")
oSheet1.RemoveRange(oRange.RangeAddress, com.sun.star.sheet.CellDeleteMode.UP)
' No BUG, ​​because the deletion is performed in column A.
oRange2 = oSheet1.GetCellRangeByName("A20")

' Example 2:
oRange = oSheet1.GetCellRangeByName("X1")
oSheet1.RemoveRange(oRange.RangeAddress, com.sun.star.sheet.CellDeleteMode.UP)
' No BUG, ​​because the deletion is performed in row 1.
oRange2 = oSheet1.GetCellRangeByName("A20")

' Example 3:
oRange = oSheet1.GetCellRangeByName("B21")
oSheet1.RemoveRange(oRange.RangeAddress, com.sun.star.sheet.CellDeleteMode.UP)
' No BUG, ​​because the range requested by the next GetCellRangeByName()
command is located above the row in which the deletion occurred (20 < 21).
oRange2 = oSheet1.GetCellRangeByName("A20")

' Example 4:
oRange = oSheet1.GetCellRangeByName("B20")
oSheet1.RemoveRange(oRange.RangeAddress, com.sun.star.sheet.CellDeleteMode.UP)
' There is a BUG, ​​because:
' 1) deletion is not in column A;
' 2) deletion is not in row 1;
' 3) range requested by the next GetCellRangeByName() command is located in the
same row in which the deletion occurred, or below it (20 = 20, 65 > 20).
oRange2 = oSheet1.GetCellRangeByName("A20")
' OR
oRange2 = oSheet1.GetCellRangeByName("F65")


Similar behavior with GetCellRangeByName("NamedRange").


Version: 25.2.2.2 (X86_64) / LibreOffice Community
Build ID: 7370d4be9e3cf6031a51beef54ff3bda878e3fac
CPU threads: 8; OS: Windows 10 X86_64 (10.0 build 19045); UI render:
Skia/Vulkan; VCL: win
Locale: ru-RU (ru_RU); UI: ru-RU
Calc: CL threaded

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to