What do you mean by “Last cell of each sheet of attached Calc is similar.”?
Well, for both sheets that’s a spreadsheet cell. This may be the only relevant similarity.
In the first sheet the last used cell is F4, and that’s what you get.
In the second sheet the last used cell is AL100, and you get AL15.
That’s a bug imo, though it is exatly what you also get via the UI using Ctrl+End.
Change the color of cell AJ18 to any different shade of yellow, and press Ctrl+End again.
Can you interpret the result without assuming a bug? I didn’t succeed.
My tests were done with LibO V7.0.0.2RC (x64 under Win 10).
I get the same results running the simplified cosd:
Sub Main
doc = ThisComponent
sheets = doc.Sheets()
For Each sheet In sheets
scc = sheet.CreateCursor
scc.gotoStartOfUsedArea(False)
scc.gotoEndOfUsedArea(True)
Print "Used area: " &scc.AbsoluteName
Next sheet
End Sub
See also: LibreOffice: XUsedAreaCursor Interface Reference
The “used cell” and thus UsedArea
seem to rely on a concept only occuring related to the interface XUsedAreCursor
. This interface has two methods, and only 1 of them is buggy.
BTW: Ctrl+Pos1 seems to always go to A1. That may NOT be the StartOfUsedArea in the sense of the linked specification. Anyway the UI actions aren’t specified clearly at all, and in this case the names chosen for the actions are funny (To Beginning of File
, To End of File
).