group and outline level button

I have an outline with buttons for levels 1-8. (LibreOffice 6 Calc).

I can click a button to hide details of all lower levels.

How can I click the button with a macro? I tried Hide, but that doesn’t collapse the outline.

Where is the API for
dispatcher.executeDispatch(document, “.uno:HideDetail”, “”, 0, Array())

TIA, Andy

The interface is com.sun.star.sheet.XSheetOutline. Here is example code.

Sub HideDetail
    oSheet = ThisComponent.getSheets().getByIndex(0)
    iStartRow = 1
    iEndRow = 5
    oCellRange = oSheet.getCellRangeByPosition(0, iStartRow, 0, iEndRow)
    oSheet.hideDetail(oCellRange.getRangeAddress())
End Sub