aspnetcore-js-devexpress-dot-richedit-e79a9667.md
Defines a table cell in the document.
export class TableCell extends TableElementBase
var table = richEdit.document.tables.getByIndex(0);
var cell = table.rows.getByIndex(0).cells.getByIndex(0);
var text = richEdit.document.subDocuments.main.getText(cell.interval)
Specifies the cell’s background color.
get backgroundColor(): string
set backgroundColor(value: string)
| Type | Description |
|---|---|
| string |
The cell’s background color.
|
The backgroundColor property allows you to obtain and change the cell’s background color.
Note
A cell’s background (TableCell.backgroundColor) overlaps the table’s background (Table.backgroundColor).
Specifies a table’s border settings.
get borders(): TableCellBorders
set borders(value: ITableCellBorders)
| Type | Description |
|---|---|
| TableCellBorders |
Cell border settings.
|
Specify the borders property to configure a cell’s border settings.
Specifies formatting settings of characters in the cell.
get characterProperties(): CharacterProperties
set characterProperties(value: ICharacterProperties)
| Type | Description |
|---|---|
| CharacterProperties |
Formatting settings of cell characters.
|
Use the characterProperties property to access and customize the formatting settings of cell characters.
const subDocument = richEdit.selection.activeSubDocument;
const table = subDocument.tables.getByIndex(0);
cell = table.rows.getByIndex(0).cells.getByIndex(0);
cell.characterProperties = { bold: true, underline: true };
Specifies the horizontal alignment of a cell’s content.
get contentHorizontalAlignment(): TableContentHorizontalAlignment | null
set contentHorizontalAlignment(value: TableContentHorizontalAlignment)
| Type | Description |
|---|---|
| TableContentHorizontalAlignment |
An enumeration value.
|
Use the contentHorizontalAlignment property to horizontally align content in a particular cell.
Note
A cell’s contentHorizontalAlignment property takes priority over the table’s contentHorizontalAlignment property.
Specifies the vertical alignment of a cell’s content.
get contentVerticalAlignment(): TableContentVerticalAlignment
set contentVerticalAlignment(value: TableContentVerticalAlignment)
| Type | Description |
|---|---|
| TableContentVerticalAlignment |
An enumeration value.
|
Use the contentVerticalAlignment property to horizontally align content in a particular cell.
Note
A cell’s contentVerticalAlignment property takes priority over the table’s contentVerticalAlignment property.
Gets an index of the cell in a table row.
get index(): number
| Type | Description |
|---|---|
| number |
The cell index.
|
Use the index to access the corresponding cell by the TableCellCollection.getByIndex method.
var table = richEdit.document.tables.getByIndex(0);
var cell = table.rows.getByIndex(0).cells.getByIndex(0);
var text = richEdit.document.subDocuments.main.getText(cell.interval)
Gets the text buffer interval occupied by the current table cell element.
get interval(): Interval
| Type | Description |
|---|---|
| Interval |
An object that contains the interval settings.
|
var table = richEdit.document.tables.getByIndex(0);
var cell = table.rows.getByIndex(0).cells.getByIndex(0);
var text = richEdit.document.subDocuments.main.getText(cell.interval)
Specifies the cell’s margin settings.
get margins(): Margins
set margins(value: IMargins)
| Type | Description |
|---|---|
| Margins |
An object that contains margin settings.
|
Use the margins property to access and customize cell margins.
Note
A cell’s margins property takes priority over the table’s cellMargins property.
Returns the row that contains the current cell.
get parentRow(): TableRow
| Type | Description |
|---|---|
| TableRow |
The row that contains the current cell.
|
Specifies the cell’s width settings.
get width(): TableWidth
set width(value: TableWidth)
| Type | Description |
|---|---|
| TableWidth |
An object that contains width settings.
|
Use the Table.width or TableCell.width property to specify the table or cell width.
Splits the cell into multiple smaller cells.
split(
columnCount: number,
rowCount: number
): void
| Name | Type | Description |
|---|---|---|
| columnCount | number |
The number of columns in the result cell range.
| | rowCount | number |
The number of rows in the result cell range.
|
Once you split a cell, its content moves to the first cell in the resulting cell range. All cells in the result range have the same appearance settings as the initial cell.
The following code snippet splits the first cell into 6 cells (3 columns and 2 rows):
const subDocument = richEdit.selection.activeSubDocument;
const table = subDocument.tables.getByIndex(0);
cell.split(3, 2);