In calc basic are there equivalents to VBA’s HorizontalAlignment, largeScroll and smallScroll?
Thanks,
Mike
In calc basic are there equivalents to VBA’s HorizontalAlignment, largeScroll and smallScroll?
Thanks,
Mike
This is an incomplete answer, just because I couldn't find VBA equivalents
doesn't mean they are not there. LO/OO is much too large a field for me to
say there are no equivalents.
However, I have found ways to shift the view of my spreadsheet.
The first is using selection. If the cell I want in view is off the page
simply selecting it will bring near center screen.
If it is already in view then selecting a cell out of view then back to
what I want center screen will do the trick.
I'm a lazy and lousy typist so taking Pitonyak's "oDoc = ThisComponent"
a little further, I've created a couple of sub/functions as so:
Function currentSheet
currentSheet = ThisComponent.CurrentController.ActiveSheet
End Function
Function cellRC( row as Long, Column as Long)
' generate a cell as in VBA, just for simplicity's sake
cellRC = currentSheet.GetCellByPosition( Column, row )
End Function
Sub objSelect(obj)
ThisComponent.CurrentController.Select(obj)
End Sub
With these it's easy to shift the view with "objSelect(cellRC(0,0))"
or objSelect(cellRC(100,100))" then back to what I wish to have midscreen.
That worked well but I ran across LO/OO's cursor commands in OOME p.506.
gotoStartOfUsedArea and especially gotoEndOfUsedArea.
The cursor is created like so:
oCurs = currentSheet.createCursor()
There are also cursor commands for moving about a range
gotoOffset(3,3), gotoStart, gotoNext, gotoPrevious, gotoEnd
Unfortunately for my purposes the cursor doesn't shift the view so after
getting the cursor where you want it it must be followed by:
objSelect(oCurs.getCellByPosition(0,0))
Finally I found this:
Sub positionView(row as Long, col as Long)
' https://ask.libreoffice.org/t/scroll-in-calc-via-api/13214
' by pierre-yves samyn
thiscomponent.currentController.setFirstVisibleColumn(col)
thiscomponent.currentController.setFirstVisibleRow(row)
End Sub
You have to calculate the offset from the edge of the view to what you
want center screen but that's likely to be trivial. In my case 4 columns
to the left of today's quotes puts today's quotes center screen
consistently.
Hope this helps somebody.
Be well,
Mike
A slight amendment, I found one situation where positionView() doesn't
shift the view. If the cursor or last selected cell is to the left of a
Freeze frame and the desired position is to the right the view doesn't
shift, don't know why.
The cell selection does shift the view as long as the selected cell is
out of view.
MM