Calc macro to hideDetail/showDetail group/ungroup

following up on

(and [calc] insérer une ligne sans qu'elle rejoigne le goupe précédent)

doing a hideDetail / unhideDetail doesn’t unhide the group. (tested on 7.6.7.2)
is it a bug, or I’m missing sth ?

note: if you unhide manually, it works just fine, and the selected cell is still in there.

side question : how to know the group range enclosing the current selection ? as sheet.hideDetail seems to get it right.

How should I know? You didn’t post code nor did you explain your actual attempts.
Are you aware of this documentation?

was yours, linked in OP :wink:

just starting on an existing group,
image

thus line 7 commented out :
image

it gives :
image

almost. :innocent:
but couldn’t find how to crawl thru the whole group range (if that what is needed), thus my side question.

and of course, not just theoretical, but trying to answer the linked French post to ungroup / add row / group.

thanks for your help,

Having already set a group of columns and one of rows the following code worked for me -with an unexpeted possible flaw- under LibO V24.2.4.2. (I didn’t test with older versions yet.)

Sub testShowHideGroups()
rg = ThisComponent.CurrentSelection
ra = rg.RangeAddress
sheet =rg.Spreadsheet
sheet.hideDetail(ra)
sheet.showDetail(ra)
End Sub

The flaw:
The .hide() worked also for groups of which only a single cell(e.g.) inside was selected.
The .show() required the full selection in width for a group of coluimns and for a full selection in height for a group of rows to work.
I did not research the behaviour of older versions or with nested groups.

Concerning possible side questions:
I never could find API means beyond the linked one. In specific I couldnt find a container of all the defined groups.

somehow related 116663 – Ungrouping collapsed rows and columns leaves them hidden