# Inserting a closed section

Is there a way to insert a closed section? I know in .m files if you do (* ::Section::Closed:: *) and open the .m file using system editor, a closed section will be displayed. Is there a way to create a closed section in the notebook while using CreateDocument[]?

-

## 1 Answer

yes, but a notebook has a more involved structure than the .m files you have investigated. The code to do what you want isn't very complicated, though:

CreateDocument[{CellGroup[{
TextCell["section", "Section"],
TextCell["content", "Text"]
}, Closed]}]

-