CellPrint
CellPrint[expr_] _RemoteCellObjCellPrint[cellExpr_] _RemoteCellObjInserts a new cell directly below the currently evaluated one. The expression expr is automatically converted to a StandardForm output cell.
Alternatively, cellExpr can be any of the following cell types:
Cell[expr_String, "Input"]Cell[expr_String, "Output"]Cell[expr_String, "Input"]Cell[expr_String, "Output", subtype_String]TextCell[expr_String]TextCell[expr_String, "Title"]TextCell[expr_String, "Section"]TextCell[expr_String, "Subsection"]ExpressionCell[expr_, "Input"]ExpressionCell[expr_, "Output"]
where the subtype property can be any view component from the available cell types:
"WLX"or"wlx""HTML"or"html""JS"or"js"or"javascript""MERMAID"or"mermaid"- ...
CellPrint returns the created RemoteCellObj, which can be further manipulated.
See also the more comprehensive functions NotebookWrite and CreateWindow for generating cells.
If it is evaluated outside the cell, new cell will be projected to a new window
Examples
Basic usage
Print a cell after the current one, displaying the current date:
cell = CellPrint[Now];Then remove it:
NotebookDelete[cell];Using different renderers
You can use WLX view components as well. First, create a template in a separate cell:
.wlx
wlTest[P_] := <div class="p-1 rounded" style="border: 1px solid blue"><P/></div>Then wrap it in the corresponding cell representation:
CellPrint[Cell[wlTest[Plot[x, {x,0,1}]], "Output", "wlx"]];