With ViewData, for example to set A2 to left top position and cursor to A2 on the first sheet:
Code: Select all
sub SetViewData
oDoc = ThisComponent
oController = oDoc.getCurrentController()
sViewData = oController.getViewData()
sParts = Split(sViewData, ";")
If UBound(sParts) >= 3 Then
sParts(3) = "0/1/0/0/0/0/2/0/0/0/1"
End If
sViewData = Join(sParts, ";")
oController.restoreViewData(sViewData)
end sub
Here is example of a ViewData and it can be divided with ";".
Code: Select all
100/60/0;0;tw:270;3/13/0/0/0/0/2/0/0/0/1;5/15/0/0/0/0/2/0/0/0/0;0/0/0/0/0/0/2/0/0/0/0
100/60/0 means zoom value of normal mode/zoom value of page break preview/view mode. 0 for active sheet number. tw:270 means unknown/position of horizontal scroll bar. And others are describes view state of each sheet.
Descriptions about sheet, each part means:
- 0: cursor position column
- 4: vertical split position
- 5: horizontal split position
- 6: index of focused window
- 7: left top column index of left side window
- 8: left top column index of right side window
- 9: row index of upper window
- 10: row index of window below
But index 7 for column position of left top cell and 10 for its row position are used for non-splitted window.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04