<cell>

A single cell within a tabular layout or spreadsheet

<cell> is a Sectional component. It is the smallest element of a <tabular> block of text or data inside a <table>.

Attributes and Properties

Attributes for <cell>

Other (7)

text. Default value: none. Border style for the bottom edge of the cell.

colNum

text. Column number where this cell is placed (1-based).

integer. Default value: 1. Number of columns this cell spans.

text. Default value: left. Horizontal alignment for the cell's content (left, center, or right).

text. Initial text content of the cell.

text. Default value: none. Border style for the right edge of the cell.

rowNum

text. Row number where this cell is placed (1-based).

Common to all components (9)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

hide

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. Default value: 1. The style number used to select this component's visual styling from the available style definitions.

Properties for <cell name="c">

Other (15)
$c.bottom

text. Border style for the bottom edge of the cell.

$c.colNum

text. Column number where this cell is placed (1-based).

$c.colSpan

integer. Number of columns this cell spans.

$c.disabled

boolean. Whether this component is disabled and cannot be interacted with.

$c.fixed

boolean. Whether this component's value is fixed and cannot be modified.

$c.fixLocation

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$c.halign

text. Horizontal alignment of the cell's content (left, center, or right).

$c.hidden

boolean. Whether this component is hidden from the rendered output.

boolean. Whether this cell is in a header row of the table.

$c.math

math. The cell's content interpreted as a math expression.

number. The cell's content interpreted as a number.

$c.prefill

text. Initial text content of the cell.

$c.right

text. Border style for the right edge of the cell.

$c.rowNum

text. Row number where this cell is placed (1-based).

$c.text

text. The cell's content as a text string.

Common to all components (4)
$c.doenetML

text. The DoenetML source code that produced this component.

$c.hide

boolean. Whether to hide this component from the rendered output.

$c.isResponse

boolean. Whether this component is treated as a response for the purposes of assessment.

$c.styleNumber

integer. The style number used to select this component's visual styling from the available style definitions.

Examples

Example: <cell> inside a <table>

Each <cell> component defines a single entry in the <table>.

Attribute Examples

Attribute Example: colSpan

The colSpan attribute allows a single <cell> to span across multiple columns. This attribute can also be used across all rows to create visually wider “columns” within a table.


Attribute Example: hAlign

The hAlign attribute governs the horizontal alignment of content within the <cell>. The default horizontal alignment is left.


Attribute Example: bottom

The bottom attribute specifies a bounding line at the bottom of the <cell>.


Attribute Example: right

The right attribute specifies a bounding line at the right edge of the <cell>.


Attribute Example: prefill

The prefill attribute provides another way to specify content within the cell.

Property Examples

Property Example: Attributes as properties

All of the attributes available to the <cell> component can also be accessed as properties.


Property Example: inHeader

The inHeader property returns the boolean value corresponding to whether the <cell> occurs within a header <row>.


Property Example: text

The text property returns the text value stored within the <cell>.


Property Example: math

The math property returns the math value stored within the <cell>.


Property Example: number

The number property returns the numerical value stored within the <cell>.