Back to Devexpress

TableCell Class

aspnetcore-js-devexpress-dot-richedit-e79a9667.md

latest7.5 KB
Original Source

TableCell Class

Defines a table cell in the document.

Declaration

ts
export class TableCell extends TableElementBase

Remarks

javascript
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)

Properties

backgroundColor Property

Specifies the cell’s background color.

Declaration

ts
get backgroundColor(): string
set backgroundColor(value: string)

Property Value

TypeDescription
string

The cell’s background color.

|

Remarks

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).

borders Property

Specifies a table’s border settings.

Declaration

ts
get borders(): TableCellBorders
set borders(value: ITableCellBorders)

Property Value

TypeDescription
TableCellBorders

Cell border settings.

|

Remarks

Specify the borders property to configure a cell’s border settings.

characterProperties Property

Specifies formatting settings of characters in the cell.

Declaration

ts
get characterProperties(): CharacterProperties
set characterProperties(value: ICharacterProperties)

Property Value

TypeDescription
CharacterProperties

Formatting settings of cell characters.

|

Remarks

Use the characterProperties property to access and customize the formatting settings of cell characters.

js
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 };

contentHorizontalAlignment Property

Specifies the horizontal alignment of a cell’s content.

Declaration

ts
get contentHorizontalAlignment(): TableContentHorizontalAlignment | null
set contentHorizontalAlignment(value: TableContentHorizontalAlignment)

Property Value

TypeDescription
TableContentHorizontalAlignment

An enumeration value.

|

Remarks

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.

contentVerticalAlignment Property

Specifies the vertical alignment of a cell’s content.

Declaration

ts
get contentVerticalAlignment(): TableContentVerticalAlignment
set contentVerticalAlignment(value: TableContentVerticalAlignment)

Property Value

TypeDescription
TableContentVerticalAlignment

An enumeration value.

|

Remarks

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.

index Property

Gets an index of the cell in a table row.

Declaration

ts
get index(): number

Property Value

TypeDescription
number

The cell index.

|

Remarks

Use the index to access the corresponding cell by the TableCellCollection.getByIndex method.

javascript
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)

interval Property

Gets the text buffer interval occupied by the current table cell element.

Declaration

ts
get interval(): Interval

Property Value

TypeDescription
Interval

An object that contains the interval settings.

|

Remarks

javascript
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)

margins Property

Specifies the cell’s margin settings.

Declaration

ts
get margins(): Margins
set margins(value: IMargins)

Property Value

TypeDescription
Margins

An object that contains margin settings.

|

Remarks

Use the margins property to access and customize cell margins.

Note

A cell’s margins property takes priority over the table’s cellMargins property.

parentRow Property

Returns the row that contains the current cell.

Declaration

ts
get parentRow(): TableRow

Property Value

TypeDescription
TableRow

The row that contains the current cell.

|

width Property

Specifies the cell’s width settings.

Declaration

ts
get width(): TableWidth
set width(value: TableWidth)

Property Value

TypeDescription
TableWidth

An object that contains width settings.

|

Remarks

Use the Table.width or TableCell.width property to specify the table or cell width.

Methods

split(columnCount, rowCount) Method

Splits the cell into multiple smaller cells.

Declaration

ts
split(
    columnCount: number,
    rowCount: number
): void

Parameters

NameTypeDescription
columnCountnumber

The number of columns in the result cell range.

| | rowCount | number |

The number of rows in the result cell range.

|

Remarks

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):

js
const subDocument = richEdit.selection.activeSubDocument;
const table = subDocument.tables.getByIndex(0);
cell.split(3, 2);