({{, (RefLink[ExpressionCell, paclet:ref/ExpressionCell])[expr] 
gives an expression cell that can appear in a Wolfram System notebook.}, {, (RefLink[ExpressionCell, paclet:ref/ExpressionCell])[expr,"style"] 
gives an expression cell with the specified style.}, {, (RefLink[ExpressionCell, paclet:ref/ExpressionCell])[expr,"(Subscript[style, 1])","(Subscript[style, 2])",…]
gives an expression cell with multiple styles applied to it.}})

OpenersNotesSection(Spacer1)Details and Options

Expression cells can contain any Wolfram Language expressions, including graphics and dynamic objects.

An (RefLink[ExpressionCell, paclet:ref/ExpressionCell]) can appear anywhere in a Wolfram Language expression.

(RefLink[ExpressionCell, paclet:ref/ExpressionCell])[expr] by default formats expr in the current default output format type, typically (RefLink[StandardForm, paclet:ref/StandardForm]).

Typical possible styles for expression cells include "Input", "Output", "Section", etc.

(RefLink[CellPrint, paclet:ref/CellPrint])[ExpressionCell[expr, "Print"]] is normally effectively equivalent to (RefLink[Print, paclet:ref/Print])[expr].

(RefLink[ExpressionCell, paclet:ref/ExpressionCell]) can have any of the many options of (RefLink[Cell, paclet:ref/Cell]), including, for example:

(RefLink[ExpressionCell, paclet:ref/ExpressionCell])[(RefLink[Null, paclet:ref/Null])] gives an empty expression cell.

OpenersPrimaryExamplesSection(Spacer1)Examples  (9)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

ExpressionCell[x^2==-1]

OpenersExampleSection1(Spacer1)Scope  (4)

2D and 3D graphics as well as formulas can be part of the content:

ExpressionCell[Graphics[Disk[]]]

ExpressionCell[Graphics3D[Sphere[]]]

ExpressionCell[Expand[(x+y+z)^3]]

An expression cell can appear within a text cell:

CellPrint[TextCell[Row[{"The equation ",ExpressionCell[TraditionalForm[x^2==-1]]," has 2 solutions."}],"Text"]]

The equation (x^2)==-1 has 2 solutions.

Use different named styles:

Table[ExpressionCell[(x^2)+x+1,s],{s,{"Input","Output","Section","Title"}}]

Use more than one style:

ExpressionCell[x^2+x+1,"Section", "TI"]

OpenersExampleSection3(Spacer1)Applications  (1)

A simple function that produces a document as an answer using expression and text cells:

documentSolve[ eqns_,vars_]:=
DocumentNotebook@TextCell[Row[{"The equation ", ExpressionCell[TraditionalForm[eqns]], " has the following solutions: ", ExpressionCell[Row[vars/.NSolve[eqns,vars],", "]]}],"Text"]

documentSolve[(x^3)+x==1,x]

OpenersExampleSection4(Spacer1)Properties & Relations  (2)

(RefLink[TextCell, paclet:ref/TextCell]) and (RefLink[ExpressionCell, paclet:ref/ExpressionCell]) format contents differently:

CellPrint[{TextCell["abcde","Text"],ExpressionCell["abcde","Text"]}]

abcde

"abcde"

(RefLink[Cell, paclet:ref/Cell]) is used for low-level descriptions, including forms that are not complete expressions:

CellPrint[Cell[BoxData[RowBox[{"a","="}]],"Input"]]

a=

OpenersExampleSection5(Spacer1)Possible Issues  (1)

Certain (RefLink[Cell, paclet:ref/Cell]) options only affect standalone cells, such as cells produced by (RefLink[CellPrint, paclet:ref/CellPrint]), and do not affect cells that occur within an output cell:

ExpressionCell[x^2==-1,CellDingbat->"◆",CellLabel->"Example"]

ExpressionCell[x^2==-1,CellDingbat->"◆",CellLabel->"Example"]//CellPrint

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[TextCell, paclet:ref/TextCell])  ▪  (RefLink[CellGroup, paclet:ref/CellGroup])  ▪  (RefLink[CellPrint, paclet:ref/CellPrint])  ▪  (RefLink[Print, paclet:ref/Print])  ▪  (RefLink[Cell, paclet:ref/Cell])  ▪  (RefLink[CreateDocument, paclet:ref/CreateDocument])  ▪  (RefLink[NotebookImport, paclet:ref/NotebookImport])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Notebook Document Generation, paclet:guide/DocumentGeneration])}, {▪(RefLinkPlain[Cell Styling Options, paclet:guide/CellStylingOptions])}, {▪(RefLinkPlain[Toolbars, paclet:guide/Toolbars])}, {▪(RefLinkPlain[Automated Reports, paclet:guide/AutomatedReports])}, {▪(RefLinkPlain[Text Generation, paclet:guide/TextConstruction])}})}})