# MailMerge.TextComponent Property

> Gets or sets the TextComponent object which is associated with the MailMerge component. It must be of the type ServerTextControl, TextControl or WPF.TextControl. The PageSize, PageMargins and Landscape properties will be used, if UseTemplateFormat has been set to false. The ServerTextControl.FormattingPrinter property will be used internally to format the text. It returns null when not specified.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 14.0
- **Namespace:** `TXTextControl.DocumentServer`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXDocumentServer.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXDocumentServer.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl.DocumentServer > MailMerge.TextComponent Property
- **902 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver/mailmerge/textcomponent-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver/mailmerge/textcomponent-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver/mailmerge/textcomponent-property/llms-full.txt

---

### Description

Gets or sets the TextComponent object which is associated with the [MailMerge](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver/mailmerge/llms-full.txt) component. It must be of the type [ServerTextControl](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/servertextcontrol/llms-full.txt), [TextControl](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/llms-full.txt) or [WPF.TextControl](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/llms-full.txt). The [PageSize](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/pagesize-property/llms-full.txt), [PageMargins](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/pagemargins-property/llms-full.txt) and [Landscape](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/landscape-property/llms-full.txt) properties will be used, if [UseTemplateFormat](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver/mailmerge/usetemplateformat-property/llms-full.txt) has been set to false. The ServerTextControl.FormattingPrinter property will be used internally to format the text. It returns null when not specified.

### Syntax

```csharp
public object TextComponent { get; set; }
```

```vbnet
Public Property TextComponent As Object
```

### Examples

The following example creates a new [MailMerge](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver/mailmerge/llms-full.txt) object and associates a [ServerTextControl](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/servertextcontrol/llms-full.txt) with it:

```csharp
TXTextControl.MailMerge mailMerge1 = new TXTextControl.MailMerge();
TXTextControl.ServerTextControl serverTextControl1 = new TXTextControl.ServerTextControl();

mailMerge1.TextComponent = serverTextControl1;
```

```vbnet
Dim MailMerge1 As TXTextControl.MailMerge = New TXTextControl.MailMerge
Dim ServerTextControl1 As TXTextControl.ServerTextControl = New TXTextControl.ServerTextControl

MailMerge1.TextComponent = ServerTextControl1
```

The following example uses `MailMerge.TextComponent` to configure text component as part of the mail merge workflow. The configured value is checked before the workflow continues.

```csharp
mailMerge.TextComponent = "Approved";
if (mailMerge.TextComponent != null)
{
    Console.WriteLine("Mail Merge: Text Component is available.");
}
```

```vbnet
mailMerge.TextComponent = "Approved"
If mailMerge.TextComponent IsNot Nothing Then
    Console.WriteLine("Mail Merge: Text Component is available.")
End If
```

---

## Nearby

- **Previous:** [MailMerge.TemplateFile Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver/mailmerge/templatefile-property/llms-full.txt)
- **Next:** [MailMerge.UseTemplateFormat Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver/mailmerge/usetemplateformat-property/llms-full.txt)
