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

OpenersNotesSection(Spacer1)Details

(RefLink[NotebookObject, paclet:ref/NotebookObject]) expressions are typically generated by kernel commands such as (RefLink[InputNotebook, paclet:ref/InputNotebook]), (RefLink[EvaluationNotebook, paclet:ref/EvaluationNotebook]), and (RefLink[Notebooks, paclet:ref/Notebooks]).

fe is a FrontEndObject that specifies the front end in which the notebook is open.

id is an integer that gives a unique serial number for this open notebook.

In (RefLink[StandardForm, paclet:ref/StandardForm]) and (RefLink[OutputForm, paclet:ref/OutputForm]), notebook objects are printed so as to indicate the current title of the window that would be used to display the notebook.

Functions such as (RefLink[NotebookPrint, paclet:ref/NotebookPrint]) and (RefLink[NotebookClose, paclet:ref/NotebookClose]) take (RefLink[NotebookObject, paclet:ref/NotebookObject]) as their argument.

Within any open notebook, there is always a current selection. The current selection can be modified by applying functions such as (RefLink[SelectionMove, paclet:ref/SelectionMove]) to (RefLink[NotebookObject, paclet:ref/NotebookObject]).

A (RefLink[NotebookObject, paclet:ref/NotebookObject]) is permanently invalid after a notebook is closed, even if that notebook is reopened.

(RefLink[Information, paclet:ref/Information]) for a (RefLink[NotebookObject, paclet:ref/NotebookObject]) may include the following properties:

OpenersPrimaryExamplesSection(Spacer1)Examples  (5)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Functions that create notebooks return (RefLink[NotebookObject, paclet:ref/NotebookObject]) expressions:

nb=CreateDocument[{1,x,x^2}]

Functions that act on notebooks take a notebook object as an argument:

SetOptions[nb,WindowTitle->"Powers"]

Retitling a notebook changes the way the (RefLink[NotebookObject, paclet:ref/NotebookObject]) expression is displayed:

nb

The (RefLink[NotebookObject, paclet:ref/NotebookObject]) expression itself has not changed:

nb===%1

OpenersExampleSection1(Spacer1)Scope  (2)

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

CreateDialog[{TextCell["Click OK to close"],DefaultButton[]}]

InputNotebook[]

First[Notebooks[]]

Open a notebook from a file:

file=FileNameJoin[{$InstallationDirectory,"Documentation","English","System","ExampleData","document.nb"}]

nb=NotebookOpen[file]

Use the (RefLink[NotebookObject, paclet:ref/NotebookObject]) to refer to the notebook in notebook operations:

SelectionMove[nb,Next,Cell]

Read selected data from the notebook:

NotebookRead[nb]

Set options for the notebook:

SetOptions[nb,Magnification->1.25]

Set options for the selected cell:

SetOptions[NotebookSelection[nb],CellMargins->0]

Insert new material into the notebook:

SelectionMove[nb,After,Cell];NotebookWrite[nb,"2+2"]

Save the notebook:

temp=CreateTemporary[]<>".nb";
NotebookSave[nb,temp]

Close the notebook and delete the temporary file:

NotebookClose[nb];
DeleteFile[temp];

OpenersExampleSection2(Spacer1)Properties & Relations  (1)

Turn a (RefLink[Notebook, paclet:ref/Notebook]) expression into a (RefLink[NotebookObject, paclet:ref/NotebookObject]):

nb=NotebookPut[Notebook[{Cell["first","Text"],Cell["second","Text"]},StyleDefinitions->"Default.nb"]]

Turn a (RefLink[NotebookObject, paclet:ref/NotebookObject]) into a (RefLink[Notebook, paclet:ref/Notebook]) expression:

NotebookGet[nb]

OpenersExampleSection3(Spacer1)Possible Issues  (1)

After a notebook has been closed, the (RefLink[NotebookObject, paclet:ref/NotebookObject]) can no longer be manipulated:

nb=CreateDocument[{1,x,x^2}]

NotebookClose@nb

NotebookInformation[nb]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[NotebookSelection, paclet:ref/NotebookSelection])  ▪  (RefLink[NotebookOpen, paclet:ref/NotebookOpen])  ▪  (RefLink[Notebooks, paclet:ref/Notebooks])  ▪  (RefLink[SelectedNotebook, paclet:ref/SelectedNotebook])  ▪  (RefLink[CellObject, paclet:ref/CellObject])  ▪  (RefLink[BoxObject, paclet:ref/BoxObject])  ▪  (RefLink[WebWindowObject, paclet:ref/WebWindowObject])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Notebooks from the Kernel, paclet:tutorial/ManipulatingNotebooksFromTheKernel])}})}})

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