Macro to group rows

Hi,
I have a worksheet with a little over 20000 lines. The first column has a class which I have sorted the data by.
I would like to group the rows under each class. Doing this using the Data/Group menu option works, however, trying to do this over 20000 lines will drive me insane.
I am able to write a macro to identify the range of rows to be grouped. I just cannot find the macro function to invoke the group action.

Thanks in advance.

Version: 5.2.7.2
Build ID: 1:5.2.7-1+deb9u7
CPU Threads: 8; OS Version: Linux 4.9; UI Render: default; VCL: gtk3;
Locale: en-AU (en_AU.UTF-8); Calc: group

Looks like I have found the answer.
The selection of the rows needs to be done first and separately to the grouping.

oProp(0).Name = "ToPoint"
oProp(0).Value = "$2:$10"
oDispatcher.executeDispatch(oFrame, ".uno:GoToCell", "", 0, oProp())

oProp(0).Name = "RowOrCol"
oProp(0).Value = "R"
oDispatcher.executeDispatch(oFrame, ".uno:Group", "", 0, oProp())

Thanks to http://openoffice3.web.fc2.com/OOoBasic_Calc_No2.html#OOoCCR13b

Why should someone want to maintain a site with untrimmed recorded macros containing coded-in ranges?
To record a macro should be the first idea of a newcomer, anyway. Strange.
See LibreOffice: XSheetOutline Interface Reference.

1 Like