A simple and efficient programmatic approach:
CurrentValue[Pick[#, CurrentValue[#, InitializationCell]] &@Cells[], InitializationCell] = Inherited;
Just evaluate this statement in the Notebook where you wish to convert all InitializationCell
s into ordinary cells, and the InitializationCell
option will be removed from the corresponding Cell[...]
expressions.
Of course it can be simplified to
CurrentValue[Cells[], InitializationCell] = Inherited;
what also works, but for large Notebooks is much slower and may require a lot of system memory.
Similar effect can be achieved manually using the technique suggested in the comment by Szabolcs:
You can select all input cells by Option-clicking (Alt-clicking on Windows?) on the cell bracket of one. Once selected, set, then unset the initialization cell flag on all of them.
One drawback is that it affects only "Input"
cells, while an initialization cell may have any style in the general case. An attempt to select the whole Notebook and apply this technique results in HUGE memory usage by the FrontEnd if the Notebook is large (due to the Undo/Redo system which memorizes every change), what can lead to freezing of the FrontEnd. So this technique should be used with care.
Note that initialization cells can be created also via setting the InitializationGroup
option (menu item Cell ► Cell Properties ► Initialization Group
). It is possible to work with it in the same way as with InitializationCell
, but we must pass the name of this option as a String
rather than Symbol
(probably because this option is still "has not been fully integrated into the long-term Wolfram Language, and is subject to change"):
CurrentValue[Pick[#, CurrentValue[#, "InitializationGroup"]] &@Cells[],
"InitializationGroup"] = Inherited;