0

是否可以摺疊當前筆記本中的所有單元組?我試過以編程方式關閉Mathematica中的所有單元組?

nb = SelectedNotebook[]; 
SelectionMove[nb, Before, CellGroup] 
FrontEndTokenExecute["OpenCloseGroup"] 

但沒有什麼變化。

+0

這可能是最好能有這個遷移。我已經標記了它。如果你也標記它,它會更快地遷移(因爲不會擔心OP希望問題留在這裏) – Szabolcs

回答

1

你可以使用

nb = SelectedNotebook[]; 
SelectionMove[nb, All, Notebook]; 
FrontEndTokenExecute[nb, "OpenCloseGroup"] 

雖然它只有在筆記本電腦用電池組啓動,而不是與孤獨的細胞工程。 (該菜單項的工作方式。)

如果你知道有cellGroupCount組,你也可以這樣做:

nb = SelectedNotebook[]; 
SelectionMove[nb, Before, Notebook] 
Do[SelectionMove[nb, Next, CellGroup]; 
FrontEndTokenExecute[nb, "OpenCloseGroup"], {cellGroupCount}] 
相關問題