<spreadsheet>
The <spreadsheet>
component renders a basic embedded spreadsheet tool.
Attributes and Properties
Attribute | Type | Values |
---|---|---|
columnHeaders = "…" | boolean | "true" "false" |
fixedColumnsLeft = "…" | integer | |
fixedRowsTop = "…" | integer | |
height = "…" | _componentSize | |
hiddenColumns = "…" | numberList | |
hiddenRows = "…" | numberList | |
minNumColumns = "…" | number | |
minNumRows = "…" | number | |
rowHeaders = "…" | boolean | "true" "false" |
width = "…" | _componentSize |
Property | Type |
---|---|
$s.cells | [ cell ] |
$s.columnHeaders | boolean |
$s.evaluatedCells | [ cell ] |
$s.fixedColumnsLeft | integer |
$s.fixedRowsTop | integer |
$s.height | _componentSize |
$s.hiddenColumns | numberList |
$s.hiddenRows | numberList |
$s.minNumColumns | number |
$s.minNumRows | number |
$s.numColumns | number |
$s.numRows | number |
$s.pointsInCells | [ point ] |
$s.rowHeaders | boolean |
$s.width | _componentSize |
Example: default <spreadsheet>
Without any additional attributes, the default <spreadsheet>
is rows by columns.
Example: referencing <spreadsheet>
data
Cells within a spreadsheet that store text values can be accessed using the following
notation: spreadsheetName.cell##.text
.
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>
s.
Example: build <spreadsheet>
with rows
Initial data can be prefilled using nested <column>
children, which in turn contain
individual <cell>
s.
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.
Example: minNumRows, minNumColumns
The default size <spreadsheet/>
of 4 rows by 4 columns has been modified with
the minNumRows
and the minNumColumns
attributes.
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.
Example: rowHeaders, columnHeaders
In this example, the rowHeaders
and columnHeaders
are suppressed by setting these attributes to false
.
Example: hiddenRows, hiddenColumns
Individual rows and columns may be hidden using the hiddenRows
and hiddenColumns
attributes.
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.