SelectedCells[notebook]
notebook 中の現行選択セルに対応するCellObject式のリストを返す.
この関数が評価されているノートブック中の現行選択セルを返す.
SelectedCells
SelectedCells[notebook]
notebook 中の現行選択セルに対応するCellObject式のリストを返す.
この関数が評価されているノートブック中の現行選択セルを返す.
詳細とオプション
- セルが選択されていない場合,SelectedCellsは空リストを返す.
- 選択範囲がセルの中の場合,SelectedCellsは選択範囲を含むセルを返す.
- SelectedCells[notebook]はCells[NotebookSelection[notebook]]と等価である.
- 選択範囲がインラインセルの中の場合,SelectedCellsはそのインラインセルに相当するCellObjectを返す.AllowInlineCells->Falseと設定すると,選択されたインラインセルを含むトップレベルのセルが返される原因になることがある.
例題
すべて開く すべて閉じる例 (3)
SelectionMove[EvaluationNotebook[], All, EvaluationCell];
SelectedCells[]SelectedCells[]nb = CreateDocument[{TextCell["first", "Title"], TextCell["second", "Section"], ExpressionCell["third", "Input"]}];
SelectionMove[nb, All, Notebook];
SelectedCells[nb]オプション (1)
AllowInlineCells (1)
デフォルトで,SelectedCellsは,スタイル"Output2"を持つ以下のセルのような,選択されたインラインセルを返す:
CellPrint[ExpressionCell[Row[{123, ExpressionCell[456, "Output2"]}], "Output"]]
SelectionMove[EvaluationCell[], After, Cell];
NotebookFind[EvaluationNotebook[], 456, Next];
SelectedCells[]AllowInlineCells->Falseとすると,最も外側のCellObjectが代りに返される:
CellPrint[ExpressionCell[Row[{123, ExpressionCell[456, "Output2"]}], "Output"]]
SelectionMove[EvaluationCell[], After, Cell];
NotebookFind[EvaluationNotebook[], 456, Next];
SelectedCells[AllowInlineCells -> False]関連するガイド
テキスト
Wolfram Research (2014), SelectedCells, Wolfram言語関数, https://reference.wolfram.com/language/ref/SelectedCells.html.
CMS
Wolfram Language. 2014. "SelectedCells." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SelectedCells.html.
APA
Wolfram Language. (2014). SelectedCells. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SelectedCells.html
BibTeX
@misc{reference.wolfram_2026_selectedcells, author="Wolfram Research", title="{SelectedCells}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/SelectedCells.html}", note=[Accessed: 27-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_selectedcells, organization={Wolfram Research}, title={SelectedCells}, year={2014}, url={https://reference.wolfram.com/language/ref/SelectedCells.html}, note=[Accessed: 27-November-2026]}