({{, (RefLink[CellObject, paclet:ref/CellObject])[id] 
is an object that represents a cell in an open notebook in the front end.}})

OpenersNotesSection(Spacer1)Details

(RefLink[CellObject, paclet:ref/CellObject]) expressions are typically generated using (RefLink[Cells, paclet:ref/Cells]), (RefLink[SelectedCells, paclet:ref/SelectedCells]), or (RefLink[EvaluationCell, paclet:ref/EvaluationCell]).

id is an integer that gives a serial number for the cell that is unique to this front end session.

In (RefLink[StandardForm, paclet:ref/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.

(RefLink[CellObject, paclet:ref/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 (RefLink[NotebookRead, paclet:ref/NotebookRead]) and (RefLink[NotebookDelete, paclet:ref/NotebookDelete]), which operate on a notebook's current selection, also support forms using (RefLink[CellObject, paclet:ref/CellObject]).

Any function that takes a (RefLink[NotebookSelection, paclet:ref/NotebookSelection]) can also take a (RefLink[CellObject, paclet:ref/CellObject]) or a list of (RefLink[CellObject, paclet:ref/CellObject]) expressions.

If the cell targeted by (RefLink[CellObject, paclet:ref/CellObject]) is deleted or if its container notebook is closed, the (RefLink[CellObject, paclet:ref/CellObject]) will no longer be valid for use. Functions that attempt to use it will generally return (RefLink[$Failed, paclet:ref/$Failed]).

A (RefLink[CellObject, paclet:ref/CellObject]) is permanently invalid after a notebook is closed or the cell is deleted, even if that notebook is reopened or the cell is pasted into the notebook again. Any changes that only affect the contents of the cell without deleting the cell entirely will leave the (RefLink[CellObject, paclet:ref/CellObject]) intact.

OpenersPrimaryExamplesSection(Spacer1)Examples  (9)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Find the (RefLink[CellObject, paclet:ref/CellObject]) for the input cell:

obj=EvaluationCell[]

Use the (RefLink[CellObject, paclet:ref/CellObject]) to target a cell for (RefLink[NotebookRead, paclet:ref/NotebookRead]):

NotebookRead[obj]

Move the selection to the contents of the cell:

SelectionMove[obj,All,CellContents]

OpenersExampleSection1(Spacer1)Scope  (7)

There are several ways to obtain a (RefLink[CellObject, paclet:ref/CellObject]):

Cells[][[15;;20]]

EvaluationCell[]

SelectionMove[EvaluationNotebook[],All,EvaluationCell];
SelectedCells[]

Get options from a cell:

CurrentValue[EvaluationCell[],FontSize]

Set options on a cell:

CellPrint[ExpressionCell["abc","Output",CellTags->"options example"]];
obj=Cells[CellTags->"options example"][[1]];
CurrentValue[obj,FontSize]=20;

Delete a cell:

Print[DynamicWrapper["waiting...",obj=EvaluationCell[]]];
Pause[3];
NotebookDelete[obj]

Overwrite a cell:

Do[CellPrint[Cell["1","Output",ShowCellTags->True,CellTags->"overwrite"<>ToString[i]]],{i,1,3}];
obj=Cells[CellTags->"overwrite2"][[1]];
NotebookWrite[obj,Cell["2","Output"]];

Move selection to a cell:

obj=EvaluationCell[];
SelectionMove[obj,All,Cell]

An invalid (RefLink[CellObject, paclet:ref/CellObject]) generally causes a (RefLink[$Failed, paclet:ref/$Failed]) result:

Print[DynamicWrapper["waiting...",obj=EvaluationCell[]]];
Pause[3];
NotebookDelete[obj];
NotebookRead[obj]

OpenersExampleSection3(Spacer1)Properties & Relations  (1)

The (RefLink[FullForm, paclet:ref/FullForm]) of a (RefLink[CellObject, paclet:ref/CellObject]) uses a unique integer to reference the cell:

EvaluationCell[]//FullForm

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Cells, paclet:ref/Cells])  ▪  (RefLink[NotebookObject, paclet:ref/NotebookObject])  ▪  (RefLink[BoxObject, paclet:ref/BoxObject])  ▪  (RefLink[NotebookSelection, paclet:ref/NotebookSelection])  ▪  (RefLink[Cell, paclet:ref/Cell])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Low-Level Notebook Programming, paclet:guide/LowLevelNotebookProgramming])}})}})