Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Close cell groups in a notebook by style
| ResourceFunction["CloseCellGroups"][] closes the cell groups from a predefined set of styles in the current notebook. | |
| ResourceFunction["CloseCellGroups"][style] closes the cell groups in the current notebook that match the style specification style. | |
| ResourceFunction["CloseCellGroups"][notebook,style] closes the cell groups in notebook that match the style specification style. | 
Open an example notebook for testing:
| In[1]:= | ![nb = NotebookPut[Import[FindFile["ExampleData/document.nb"]]];](https://www.wolframcloud.com/obj/resourcesystem/images/09d/09df4e8f-5651-4354-a70b-1d484981dbd7/78d41679ba69fa9f.png) | 

Close all of the Section groups:
| In[2]:= | ![ResourceFunction["CloseCellGroups"][nb, "Section"];](https://www.wolframcloud.com/obj/resourcesystem/images/09d/09df4e8f-5651-4354-a70b-1d484981dbd7/35600cac1526f4c5.png) | 

| In[3]:= | ![NotebookClose[nb];](https://www.wolframcloud.com/obj/resourcesystem/images/09d/09df4e8f-5651-4354-a70b-1d484981dbd7/16a16bb6778bd53d.png) | 
Retrieve the function:
| In[4]:= | ![ResourceFunction["CloseCellGroups"]](https://www.wolframcloud.com/obj/resourcesystem/images/09d/09df4e8f-5651-4354-a70b-1d484981dbd7/3fbfeaa80d244ac5.png) | 
| Out[4]= |  | 
Retrieve the resource:
| In[5]:= | ![ResourceObject["CloseCellGroups"]](https://www.wolframcloud.com/obj/resourcesystem/images/09d/09df4e8f-5651-4354-a70b-1d484981dbd7/5d7c5f172a1991fc.png) | 
| Out[5]= |  | 
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License