<spreadsheet>
<spreadsheet> is a General Operator
component that renders a basic embedded spreadsheet tool.
Attributes and Properties
Attributes for <spreadsheet>
Other (10)
boolean. Default value: true. Header labels for the columns.
integer. Default value: 0. Number of left columns fixed in place when scrolling.
integer. Default value: 0. Number of top rows fixed in place when scrolling.
componentSize. Display height of the spreadsheet.
number. Default value: 4. Minimum number of columns displayed.
number. Default value: 4. Minimum number of rows displayed.
boolean. Default value: true. Header labels for the rows.
componentSize. Default value: {"size":100,"isAbsolute":false}. Display width of the spreadsheet.
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <spreadsheet name="s">
Other (25)
$s.cells[ cell ]. The raw text contents of all cells.
$s.columnHeadersboolean. Header labels for the columns.
$s.columns[ cell ]. The cells grouped by column.
$s.disabledboolean. Whether this component is disabled and cannot be interacted with.
$s.evaluatedCells[ cell ]. The evaluated values of all cells.
$s.evaluatedColumns[ cell ]. The evaluated cell values grouped by column.
$s.evaluatedRows[ cell ]. The evaluated cell values grouped by row.
$s.fixedboolean. Whether this component's value is fixed and cannot be modified.
$s.fixedColumnsLeftinteger. Number of left columns fixed in place when scrolling.
$s.fixedRowsTopinteger. Number of top rows fixed in place when scrolling.
$s.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$s.heightcomponentSize. Display height of the spreadsheet.
$s.minNumColumnsnumber. Minimum number of columns displayed.
$s.minNumRowsnumber. Minimum number of rows displayed.
$s.numColumnsnumber. The number of columns.
$s.numRowsnumber. The number of rows.
$s.pointsInCells[ point ]. Cells whose values are interpreted as points.
$s.pointsInColumns[ point ]. Cell-derived points grouped by column.
$s.pointsInRows[ point ]. Cell-derived points grouped by row.
$s.rowHeadersboolean. Header labels for the rows.
$s.rows[ cell ]. The cells grouped by row.
$s.widthcomponentSize. Display width of the spreadsheet.
Common to all components (4)
$s.doenetMLtext. The DoenetML source code that produced this component.
$s.hideboolean. Whether to hide this component from the rendered output.
$s.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$s.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: default <spreadsheet>
Without any additional attributes, the default <spreadsheet> is rows by columns.
Example: referencing <spreadsheet> data
Values stored within individual cells of a <spreadsheet> can be accessed using the following
notation: spreadsheetName.cell## where ## is the column letter and row number of the cell.
For example, $foods.cellA2 refers to the cell in the first column and second row of the
<spreadsheet> component.
Example: <spreadsheet> with <cell> children
Initial data can be prefilled using nested <cell> children. The rowNum and colNum attributes
can be used to locate data.
When only one or neither of these attributes is specified, data is populated in the following manner:
- data is placed in the first row, first column
- subsequent entries are placed in the next availabe column, in the same row
- if only the column number is specified, data is placed in the previously used row
- if only the row number is specified, data is placed in the previously used column
Example: build <spreadsheet> with rows
Initial data can be prefilled using nested <row> children, which in turn contain
individual <cell> children.
Example: build <spreadsheet> with columns
Initial data can be prefilled using nested <column> children, which in turn contain
individual <cell> children.
Example: using spreadsheets for computations
Spreadsheet computation formulas can be entered directly into an individual <cell> component.
References for data within spreadsheets follow standard spreadsheet naming conventions,
but no $ is required. Formulas can be prefilled, or entered manually by the user by clicking on the cell.
Try directly entering a formula into cell B3 that references one or more of the other cells.
Attribute Examples
Attribute Example: minNumRows, minNumColumns
The default size <spreadsheet/> of 4 rows by 4 columns has been modified with
the minNumRows and the minNumColumns attributes.
Attribute Example: width, height
The default size <spreadsheet> component (100% of available screen width) is shown
above one with a specified width of 50% of available width.
Attribute Example: rowHeaders, columnHeaders
In this example, the rowHeaders and columnHeaders are suppressed by setting these attributes to false.
Attribute Example: hiddenRows, hiddenColumns
Individual rows and columns may be hidden using the hiddenRows and hiddenColumns attributes.
Attribute Example: fixedRowsTop, fixedColumnsLeft
Individual rows and columns may be fixed in place during scrolling using the fixedRowsTop and fixedColumnsLeft attributes. Each of these accepts an integer value for the number of rows or columns to fix in place.
Since Doenet will allow for as much height as required for the spreadsheet to display its rows, this effect is easier to observe with the columns than the rows.