({{, (RefLink[NotebookPut, paclet:ref/NotebookPut])[expr]
creates a notebook corresponding to expr and makes it the currently selected notebook in the front end. }, {, (RefLink[NotebookPut, paclet:ref/NotebookPut])[]
creates a new empty notebook.}, {, (RefLink[NotebookPut, paclet:ref/NotebookPut])[expr,obj]
replaces the notebook represented by the notebook object obj with one corresponding to expr. }})

OpenersNotesSection(Spacer1)Details

(RefLink[NotebookPut, paclet:ref/NotebookPut]) is a low-level function that allows you to take a raw notebook expression in the kernel and make it an open notebook in the front end.

The expression expr should have head (RefLink[Notebook, paclet:ref/Notebook]), and contain raw (RefLink[Cell, paclet:ref/Cell]) objects, with boxes data.

(RefLink[NotebookPut, paclet:ref/NotebookPut]) returns a (RefLink[NotebookObject, paclet:ref/NotebookObject]) corresponding to the notebook it creates.

(RefLink[NotebookPut, paclet:ref/NotebookPut])[expr,obj] overwrites whatever data was contained in the notebook represented by the notebook object obj. »

(RefLink[NotebookPut, paclet:ref/NotebookPut]) can take any notebook option. »

OpenersPrimaryExamplesSection(Spacer1)Examples  (7)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

NotebookPut[Notebook[{Cell["Subsection heading","Subsection"],Cell["Some text.","Text"]}]];

Assign a generated notebook object to a symbol:

nb=NotebookPut[Notebook[{Cell["Subsection heading","Subsection"],Cell["Some text.","Text"]}]];

Rewrite the notebook content:

NotebookPut[Notebook[{Cell["Replacement content.","Subsection"]}],nb];

OpenersExampleSection1(Spacer1)Options  (2)

OpenersExampleSubsection0(Spacer1)Background  (1)

Set the background color:

NotebookPut[Notebook[{Cell["Section heading","Subsection"],Cell["Some text.","Text"]}],Background->GrayLevel[0.5]];

OpenersExampleSubsection1(Spacer1)WindowTitle  (1)

An explicit setting of (RefLink[WindowTitle, paclet:ref/WindowTitle]) is reflected in the name of the resulting notebook object:

NotebookPut[Notebook[{Cell["Section heading","Subsection"],Cell["Some text.","Text"]}],WindowTitle->"Example Notebook"];

OpenersExampleSection2(Spacer1)Applications  (1)

Create a palette for generating a choice of new template notebooks using specific stylesheets:

CreateWindow[PaletteNotebook[Column[{
Button["Start Outline", NotebookPut[Notebook[{Cell["My outline title","Title"],Cell["Level 1 Topic","Outline1"],Cell["Level 2 Topic","Outline1"],Cell["Level 3 Topic","Outline1"]}],StyleDefinitions->FrontEnd`FileName[{"Utility"},"Outline.nb"]]],
Button["Start Preprint", 
NotebookPut[Notebook[{Cell["Preprint Title","Title"],Cell["Preprint Subtitle is Optional","Subtitle"],Cell["Abstract begins here...","Abstract"],Cell["Author Name","Author"],
Cell["author@domain.net","AuthorEmail"],
Cell["Section","Section"],Cell["Text begins here...","Text"]}],StyleDefinitions->FrontEnd`FileName[{"Article"},"Preprint.nb"]]]},
Spacings->0],
WindowTitle->"Palette"]];

OpenersExampleSection3(Spacer1)Properties & Relations  (1)

(RefLink[NotebookPut, paclet:ref/NotebookPut]) and similar low-level functions require detailed specifications:

NotebookPut[Notebook[{Cell[BoxData[GridBox[{{ButtonBox["Sample Button",Appearance->Automatic,ButtonFrame->"DialogBox",ButtonFunction:>CreateDocument[],Evaluator->Automatic,Method->"Preemptive"]}}]]]},
Active->True,CellMargins->{{0,0},{0,0}},ImageMargins->{{0,0},{0,0}},WindowFrame->"Palette",WindowFrameElements->"CloseBox",WindowElements->{},WindowSize->All,WindowClickSelect->False,WindowFloating->True,WindowTitle->"Palette",ShowCellBracket->False,WindowClickSelect->False]];

(RefLink[CreatePalette, paclet:ref/CreatePalette]) and other high-level notebook functions create the same result more easily:

CreatePalette[Column[{Button["Sample Button",CreateDocument[]]}],WindowTitle->"Palette"];

OpenersExampleSection4(Spacer1)Neat Examples  (1)

Create a staggered series of notebooks using (RefLink[Map, paclet:ref/Map]) and (RefLink[WindowMargins, paclet:ref/WindowMargins]):

m=1;
NotebookPut[#]&/@(Notebook[{#}, WindowMargins->{{m++20,Inherited},{Inherited,m++30}}]&/@{Cell["First","Subsection"],Cell["Second","Subsection"],Cell["Third","Subsection"]});

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[CreateWindow, paclet:ref/CreateWindow])  ▪  (RefLink[CreateDocument, paclet:ref/CreateDocument])  ▪  (RefLink[CreatePalette, paclet:ref/CreatePalette])  ▪  (RefLink[CreateDialog, paclet:ref/CreateDialog])  ▪  (RefLink[NotebookGet, paclet:ref/NotebookGet])  ▪  (RefLink[NotebookOpen, paclet:ref/NotebookOpen])  ▪  (RefLink[Put, paclet:ref/Put])  ▪  (RefLink[SendMail, paclet:ref/SendMail])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Notebooks as Wolfram Language Expressions, paclet:tutorial/NotebooksAsWolframLanguageExpressions])}})}})

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