Wolfram Research

Function Repository Resource:

CloseCellGroups

Source Notebook

Close cell groups in a notebook by style

Contributed by: Richard Hennigan (Wolfram Research)

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.

Details and Options

CloseCellGroups allows you to close only the cell groups in a notebook that have a particular style. For example, CloseCellGroups["Section"] allows you to close all the Section groups while leaving Subsections unchanged.
The style specification can be given as a string, pattern or list of cell styles.

Examples

Basic Examples

Open an example notebook for testing:

In[1]:=
nb = NotebookPut[Import[FindFile["ExampleData/document.nb"]]];

Close all of the Section groups:

In[2]:=
ResourceFunction["CloseCellGroups"][nb, "Section"];
In[3]:=
NotebookClose[nb];

Scope

Retrieve the function:

In[4]:=
ResourceFunction["CloseCellGroups"]
Out[4]=

Retrieve the resource:

In[5]:=
ResourceObject["CloseCellGroups"]
Out[5]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

See Also

License Information