SplitWindow cross control

Hello, I use Ubuntu LTS 18.04 and LibreOffice 6.3. I want to use the Calc SplitWindow function in a Basic Macro. How can I setup the SplitWindow cross so that is lays on a certain row and column number. If I use the record function in Calc then this function did not record the end position of the cross in the dispatch macro that it builds.




Sub sheetCurrentControllerPanelsDemo()
doc = ThisComponent
cCtrl = doc.CurrentController
cCtrl.splitAtPosition(400, 200) REM xPixel As Long, yPixels As Long
cCtrl(0).FirstVisibleColumn = 0
cCtrl(0).FirstVisibleRow = 0
cCtrl(3).FirstVisibleColumn = 19
cCtrl(3).FirstVisibleRow = 888
n = cCtrl.Count REM number of panels; ordered TL, BL, TR, BR
For j = 0 To n - 1
  j_panel = cCtrl(j)
  Print j_panel.ReferredCells.AbsoluteName
Next j
End Sub  

You will see.

If you actually want to split regarding columns/rows, I think you need to lookup the positions or add widths/heights. However, splitting is view-oriented, and the pixel measur should be appropriate.

Hi, I thank you for the quick reply and will test your code. This will take some time because I lost my code and need to write it again. When I am ready again you will hear from me.

Set the starting cell in the macro …

In the example below Plan1.B9

Sub SplitWindow
Dim split(0) as new com.sun.star.beans.PropertyValue : split(0).Name = "ToPoint" : split(0).Value = "Plan1.B9"
CreateUnoService("com.sun.star.frame.DispatchHelper") _
.executeDispatch(ThisComponent.CurrentController.Frame, ".uno:GoToCell", "", 0, split())
CreateUnoService("com.sun.star.frame.DispatchHelper") _
.executeDispatch(ThisComponent.CurrentController.Frame, ".uno:SplitWindow", "", 0, Array())
End Sub

Hi, I investigated the problem again and found that I choosed the wrong cell address. After correcting that it workes as expected.