If I have columns D through L displayed and jump to a cell in column M, the display changes such that column M is approximately centered. How can I change it so that column M (or whichever column I jump to) will be the right most column in the view. The best I can do after experimenting is to move one cell at a time left (goleft) far enough to assure M goes off screen and then goright the same number of times. While this works, it seems hokey and is visually distracting. Is there something better? Below is the code I currently have for aligning the column to the right after a cell is selected.
I'd rather not change the displayed columns at all if the new cell is already on screen but maybe that part is a separate question.
Code: Select all
Sub GoRightNow
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
osheet = thiscomponent.currentcontroller.activesheet
cctrl = thiscomponent.currentcontroller
b = 30
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "By"
args1(0).Value = 1
args1(1).Name = "Sel"
args1(1).Value = false
for i = 1 to b
dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args1())
next i
ocell2 = thiscomponent.getcurrentselection()
cctrl.select(ocell2)
for i = 1 to b
dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args1())
next i
ocell2 = thiscomponent.getcurrentselection()
cctrl.select(ocell2)
End sub
Apache Openoffice 4.1.3