Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you write to a CellRange being part of a row you can select that range to get it into the view.
See also:

Sub demo()
theRange = ThisComponent.Sheets(0).GetCellRangeByPosition(90,999,999,999)
'Only for the demo. Actually the range / cell you want to have in the view.
'The leading cell will have the focus. To avoid inadvertent editing
'it might best be  an unused cell.
ThisComponent.CurrentController.Select(theRange)
nullRgs = ThisComponent.CreateInstance("com.sun.star.sheet.SheetCellRanges")
ThisComponent.CurrentController.Select(nullRgs)
End Sub

If you write (I wanted to a CellRange being part of a row you can select that range to get it into withdraw the view.
See also:
post because I was not sure about its value.)

Sub demo()
theRange = ThisComponent.Sheets(0).GetCellRangeByPosition(90,999,999,999)
'Only for the demo. Actually the range / cell you want to have in the view.
'The leading cell will have the focus. To avoid inadvertent editing
'it might best be  an unused cell.
ThisComponent.CurrentController.Select(theRange)
nullRgs = ThisComponent.CreateInstance("com.sun.star.sheet.SheetCellRanges")
ThisComponent.CurrentController.Select(nullRgs)
End Sub

(I wanted to withdraw the post because I was not sure about its value.)A very raw attempt:

Sub demo()
'freeze a range of rows/columns containing cell A1.
theRange = ThisComponent.Sheets(0).GetCellRangeByPosition(90,999,999,999)
'Only for the demo. Actually the range / cell you want to have in the view.
ThisComponent.CurrentController.Select(theRange)
'Let's assume the cell you want to get the focus is A1.
'You need to go there without selecting the cell.
'I do not know a way using the API, but the you can do it with
'an uno command using the dispatcher.
'From a recorded macro:
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
'If A1 is in the frozen range, the previously selected range should 
'still be in the view.
End Sub

A very raw attempt:

Sub demo()
'freeze a range of rows/columns containing cell A1.
A1.'
theRange = ThisComponent.Sheets(0).GetCellRangeByPosition(90,999,999,999)
'Only for the demo. Actually the range / cell you want to have in the view.
view.'
ThisComponent.CurrentController.Select(theRange)
'Let's assume the cell you want to get the focus is A1.
A1.'
'You need to go there without selecting the cell.
cell.'
'I do not know a way using the API, but the you can do it with
with'
'an uno command using the dispatcher.
dispatcher.'
'From a recorded macro:
macro:'
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
'If A1 is in the frozen range, the previously selected range should  '
'still be in the view.
view.'
End Sub

A very raw attempt:

Sub demo()
'freeze a range of rows/columns containing cell A1.'
theRange = ThisComponent.Sheets(0).GetCellRangeByPosition(90,999,999,999)
 'Only for the demo. Actually the range / cell you want to have in the view.'
 ThisComponent.CurrentController.Select(theRange)
 'Let's assume the cell you want to get the focus is A1.'
'You need to go there without selecting the cell.'
'I do not know a way using the API, but the you can do it with'
'an uno command using the dispatcher.'
'From a recorded macro:'
 document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
 'If A1 is in the frozen range, the previously selected range should '
'still be in the view.'
 End Sub

A very raw attempt:

Sub demo()
'freeze a range of rows/columns containing cell A1.'
theRange = ThisComponent.Sheets(0).GetCellRangeByPosition(90,999,999,999)

'Only for the demo. Actually the range / cell you want to have in the view.'

ThisComponent.CurrentController.Select(theRange)

'Let's assume the cell you want to get the focus is A1.'
'You need to go there without selecting the cell.'
'I do not know a way using the API, but the you can do it with'
'an uno command using the dispatcher.'
'From a recorded macro:'

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())

'If A1 is in the frozen range, the previously selected range should '
'still be in the view.'

End Sub

Edit1 with regard to the recent comment by the OQ:
I didn't just tell a story. You may play with this attached demo. Of course, my input doesn't come from a barcode scanner. A1 having the focus and getting input from elsewhere should, however, work as well.