TableCell Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WinForms. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WinForms. SDK TXTextControl.from the setup.dll
Description
An instance of the TableCell class represents a single cell of a table in a Text Control document. It can be obtained from the table's cell collection.
Syntax
public class TableCellPublic Class TableCellExamples
The following example shows how to handle table cells.
TableCell myCell = myTable.Cells.GetItem(1, 1);
myCell.Width = 2 * 1440; // 2 inches
myCell.Text = "Some sample text";
myCell.Select();
textControl1.Selection.FontSize = 8 * 20; // 8pt
textControl1.Selection.ParagraphFormat.Alignment = HorizontalAlignment.Right;Dim MyCell As TableCell = MyTable.Cells.GetItem(1, 1)
MyCell.Width = 2 * 1440 ' 2 inches
MyCell.Text = "Some sample text"
MyCell.Select()
TextControl1.Selection.FontSize = 8 * 20 ' 8pt
TextControl1.Selection.ParagraphFormat.Alignment = HorizontalAlignment.RightThe following example creates a small report table and works with its structure.
textControl.Tables.Add(3, 3, 10);
Table table = textControl.Tables.GetItem(10);
TableCell tableCell = table.Cells[2, 2];textControl.Tables.Add(3, 3, 10)
Dim table As Table = textControl.Tables.GetItem(10)
Dim tableCell As TableCell = table.Cells(2, 2)Members
Properties
| Property | Description |
|---|---|
| CellFormat | Gets or sets the formatting attributes of a table cell. The property's value is an object of the type TableCellFormat. |
| Column | Gets the table cell's column number. |
| Formula | Gets or sets the table cell's formula. For each table cell a formula can be defined which is used to calculate the cell's text. The formula can contain references to other table cells in the same table. When the text of a referenced cell changes, the cell which references it is automatically updated. The Supported Formula Functions section lists all supported formulas. Cell references can be specified either with the A1 or with the R1C1 notation. The A1 notation specifies a table cell with a column letter and a row number, for example B3 refers to the table cell in the third row and the second column. The R1C1 notation addresses a table cell with a row number and a column number, for example R3C2 refers to the same table cell in the third row and the second column. Relative addresses can be expressed with square brackets, for example R[-3]C[-2]. The numbers inside the square brackets show how many rows or columns the cell is relative to itself. Negative row numbers mean that the referenced cell is above the cell containing the formula. Negative column numbers mean that the referenced cell is to the left of the cell containing the formula. To switch the reference style the FormulaReferenceStyle property can be used. The formula's result is formatted according to the format specified with the TableCellFormat.NumberFormat property. |
| Length | Gets the number of characters in the table cell. If the table cell is merged, the property returns -1. |
| Name | Gets or sets the cell's name. Each table cell can have a name, which can be used to store any string data associated with the cell. |
| Position | Gets or sets, in twips, the horizontal position of the cell. |
| Row | Gets the table cell's row number. |
| Start | Gets the index (one-based) of the first character in the table cell. |
| Text | Gets or sets the cell's text. |
| Width | Gets or sets, in twips, the width of the cell. |
Methods
| Method | Description |
|---|---|
| Select | Selects the table cell. |