CellObject
CellObject[id]
is an object that represents a cell in an open notebook in the front end.
Details
- CellObject expressions are typically generated using Cells, SelectedCells, or EvaluationCell.
- id is a string that gives a UUID for the cell that is globally unique. id typically corresponds to the cell's ExpressionUUID.
- CellObject[id,instance] includes a second UUID for instance that allows distinguishing cells using identical id identifiers, as may happen when working with a copied file.
- CellObject may contain additional, implementation-dependent arguments.
- In StandardForm, cell objects are printed so as to indicate the current style of the cell. Clicking on the cell object will act as a hyperlink that targets that cell.
- CellObject is useful for designating target cells for various notebook operations without altering the state of the current selection in the notebook.
- Some notebook manipulation functions, such as NotebookRead and NotebookDelete, which operate on a notebook's current selection, also support forms using CellObject.
- Any function that takes a NotebookSelection can also take a CellObject or a list of CellObject expressions.
- If the cell targeted by CellObject is deleted or if its container notebook is closed, the CellObject will no longer be valid for use. Functions that attempt to use it will generally return $Failed.
- If a targeted cell is deleted and the deletion is undone using Edit ▶ Undo, the original CellObject will be valid again.
- If a notebook containing a targeted cell is reopened, the original CellObject will be valid again.
- Operations that only affect the contents or options of the cell without deleting the cell entirely will leave the CellObject intact.
- If copies of a cell are made using Edit ▶ Copy, the CellObject will only target the original cell, not the copies.
Examples
open allclose allBasic Examples (1)
Find the CellObject for the input cell:
Use the CellObject to target a cell for NotebookRead:
Scope (8)
There are several ways to obtain a CellObject:
Use NotebookRead to get the underlying cell expression:
An invalid CellObject generally causes a $Failed result:
Properties & Relations (1)
The FullForm of a CellObject uses UUIDs to reference the cell:
Text
Wolfram Research (2012), CellObject, Wolfram Language function, https://reference.wolfram.com/language/ref/CellObject.html (updated 2022).
CMS
Wolfram Language. 2012. "CellObject." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/CellObject.html.
APA
Wolfram Language. (2012). CellObject. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CellObject.html