# Table.MergeCells Method

> Merges all selected table cells in this table. The Table.CanMergeCells property can be used to determine, if table cells can be merged or not.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 17.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.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 for Windows Forms > Reference > TXTextControl > Table.MergeCells Method
- **477 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/table/mergecells-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/table/mergecells-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/table/mergecells-method/llms-full.txt

---

### Description

Merges all selected table cells in this table. The [Table.CanMergeCells](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/table/canmergecells-property/llms-full.txt) property can be used to determine, if table cells can be merged or not.

### Syntax

```csharp
public bool MergeCells();
```

```vbnet
Public Function MergeCells() As Boolean
```

### Return Value

The return value is true, if table cells could be merged. Otherwise it is false.

### Examples

The following example creates a single header cell by merging the cells in the first row.

```csharp
textControl.Tables.Add(3, 3, 10);
Table table = textControl.Tables.GetItem(10);

table.Select(1, 1, 1, 3);
table.MergeCells();
```

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

table.Select(1, 1, 1, 3)
table.MergeCells()
```

---

## Nearby

- **Previous:** [Table.ID Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/table/id-property/llms-full.txt)
- **Next:** [Table.NestedLevel Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/table/nestedlevel-property/llms-full.txt)
