Bug 167175 - Wrong returned value of oSheet.GoToEndOfUsedArea(False) in Calc Basic version 25.2.4.3
Summary: Wrong returned value of oSheet.GoToEndOfUsedArea(False) in Calc Basic version...
Status: RESOLVED DUPLICATE of bug 167178
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
25.2.4.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-23 16:39 UTC by Zdenek Borecky
Modified: 2025-06-24 07:07 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
A sample with the macro (9.04 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-06-23 17:02 UTC, Mike Kaganski
Details
Example file where occured bug (120.46 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-06-24 06:39 UTC, Zdenek Borecky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Borecky 2025-06-23 16:39:24 UTC
Description:
I have function maxsr(sheet) for return last row and column of data on sheet:

GetRangeAddress() in this function return wrong Sheet, line and column only, regardless of the actual number of rows and columns on sheet.

Bug is in version 25.2.4.3 (Windows and Ubuntu)
Not in versions 25.2.3.2. an lowers, it works correctly here

Steps to Reproduce:
function maxsr(Sheet)
  oSheet = Sheet.CreateCursor()     ' skip cursor to end of data on sheet     
  oSheet.GoToEndOfUsedArea(False)
  maxsr = oSheet.GetRangeAddress()  
End Function

Actual Results:
Returned array is:

Sheet = 38
StartColumn = 38
StartRow = 196
EndColumn = 38
EndRow = 196

Expected Results:
nuber of last row and column on the sheet and Sheet


Reproducible: Always


User Profile Reset: No

Additional Info:
Version 25.2.4.3
https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h=33e196637044ead23f5c3226cde09b47731f7e27

The same behavior is in the same version on Windows11, but I don't have the build number available right now
Comment 1 Mike Kaganski 2025-06-23 17:02:03 UTC
Created attachment 201431 [details]
A sample with the macro

Can't repro. Calling `tst_maxsr` in the attachment gives "Sheet: 0 Start column: 3 Start row: 9 End column: 3 End row: 9", as expected.
Comment 2 Zdenek Borecky 2025-06-23 17:28:12 UTC
I have about 160 to 400 lines where I have the bug. Table has about 35 to 40 lists
Comment 3 Zdenek Borecky 2025-06-24 06:39:49 UTC
Created attachment 201438 [details]
Example file where occured bug
Comment 4 Zdenek Borecky 2025-06-24 06:54:03 UTC
I add file "Example file where you can see the bug" I deleted sensitive data in this file.
Please call from menu SURO/Novy projekt
it call the NewProject() function, line 1214
In dialog you must write any number and first and last date
Next is called function maxsr() on line 1266 where is critical code
and it returm wrong data to aRangeAddres
Sheet = 5
StartColumn = 8
StartRow = 196
EndColumn = 8
EndRow = 196
True may be last line and column of list "Sablona"
StartColumn = 15
StartRow = 304
EndColumn = 15
EndRow = 304

maxsr() function is on line 2695

The same bugs are in every functions which calls maxsr()
Comment 5 Mike Kaganski 2025-06-24 07:03:18 UTC
(In reply to Zdenek Borecky from comment #4)
> In dialog you must write any number and first and last date

What format do the date controls accept? I tried e.g. 2025-01-01, 6/24/2025 (en-US), and 24.6.2025; all three were rejected (as soon as I move cursor elsewhere, it clears the box).
Comment 6 Mike Kaganski 2025-06-24 07:07:13 UTC
Found it; it took 25/6/2025.

(In reply to Zdenek Borecky from comment #4)
> Next is called function maxsr() on line 1266 where is critical code
> and it returm wrong data to aRangeAddres
> Sheet = 5
> StartColumn = 8
> StartRow = 196
> EndColumn = 8
> EndRow = 196
> True may be last line and column of list "Sablona"
> StartColumn = 15
> StartRow = 304
> EndColumn = 15
> EndRow = 304

It's because at that stage, oSablona points to "Lidi", not "Sablona".

*** This bug has been marked as a duplicate of bug 167178 ***