# TableCell Class

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

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Class
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET Server > Reference > TXTextControl > TableCell Class
- **1577 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/llms-full.txt

---

### 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

```csharp
public class TableCell
```

```vbnet
Public Class TableCell
```

### Examples

The following example shows how to handle table cells.

```csharp
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;
```

```vbnet
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.Right
```

The following example creates a small report table and works with its structure.

```csharp
textControl.Tables.Add(3, 3, 10);
Table table = textControl.Tables.GetItem(10);
TableCell tableCell = table.Cells[2, 2];
```

```vbnet
textControl.Tables.Add(3, 3, 10)
Dim table As Table = textControl.Tables.GetItem(10)
Dim tableCell As TableCell = table.Cells(2, 2)
```

---

## In This Section

- [TableCell.CellFormat Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/cellformat-property/llms-full.txt): Gets or sets the formatting attributes of a table cell. The property's value is an object of the type TableCellFormat.
- [TableCell.Column Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/column-property/llms-full.txt): Gets the table cell's column number.
- [TableCell.Formula Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/formula-property/llms-full.txt): 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.
- [TableCell.Length Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/length-property/llms-full.txt): Gets the number of characters in the table cell. If the table cell is merged, the property returns -1.
- [TableCell.Name Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/name-property/llms-full.txt): 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.
- [TableCell.Position Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/position-property/llms-full.txt): Gets or sets, in twips, the horizontal position of the cell.
- [TableCell.Row Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/row-property/llms-full.txt): Gets the table cell's row number.
- [TableCell.Select Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/select-method/llms-full.txt): Selects the table cell.
- [TableCell.Start Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/start-property/llms-full.txt): Gets the index (one-based) of the first character in the table cell.
- [TableCell.Text Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/text-property/llms-full.txt): Gets or sets the cell's text.
- [TableCell.Width Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/width-property/llms-full.txt): Gets or sets, in twips, the width of the cell.

---

## Nearby

- **Previous:** [TableBaseCollection.SyncRoot Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablebasecollection/syncroot-property/llms-full.txt)
- **Next:** [TableCell.CellFormat Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/tablecell/cellformat-property/llms-full.txt)
