CellPrint

CellPrint[expr]

inserts expr as a complete cell in the current notebook just below the cell being evaluated.

CellPrint[{expr1,expr2,}]

inserts a sequence of cells.

Details

  • If expr has head TextCell, ExpressionCell, or CellGroup, it is inserted unchanged into the notebook. »
  • If expr is a string or Text object, a text cell is created to contain it. »
  • If expr is any other type of expression, an expression cell is created to contain it. »
  • With a textbased front end, CellPrint[cell] does the same as applying Print to the contents of cell.
  • Cells generated by CellPrint by default have GeneratedCell->True, so that they are overwritten if they are regenerated.

Examples

open allclose all

Basic Examples  (3)

Create a text cell from a TextCell object:

Create a sequence of text cells:

Create a text cell from a string:

a

Scope  (4)

Strings are converted to TextCell objects:

xxx
xxx

General expressions are converted to ExpressionCell objects:

x2+y2
x2+y2

Lists are converted to multiple cells:

xxx x2+y2

Print cells with specific styles:

Properties & Relations  (1)

Print is a special case of CellPrint:

Possible Issues  (3)

Setting CellAutoOverwrite->False and repeatedly evaluating will not delete printed cells:

Setting CellAutoOverwrite and GeneratedCell can cause unexpected results:

Evaluating input cells generated by CellPrint may put outputs in unexpected places, due to the CellAutoOverwrite and GeneratedCell settings in other cells generated by CellPrint:

heading cell

text cell
Wolfram Research (1996), CellPrint, Wolfram Language function, https://reference.wolfram.com/language/ref/CellPrint.html (updated 2007).

Text

Wolfram Research (1996), CellPrint, Wolfram Language function, https://reference.wolfram.com/language/ref/CellPrint.html (updated 2007).

CMS

Wolfram Language. 1996. "CellPrint." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/CellPrint.html.

APA

Wolfram Language. (1996). CellPrint. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CellPrint.html

BibTeX

@misc{reference.wolfram_2024_cellprint, author="Wolfram Research", title="{CellPrint}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/CellPrint.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_cellprint, organization={Wolfram Research}, title={CellPrint}, year={2007}, url={https://reference.wolfram.com/language/ref/CellPrint.html}, note=[Accessed: 21-November-2024 ]}