# SubTextPart.Save Method

> Saves the subtextpart's text with the specified format.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 23.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 > SubTextPart.Save Method
- **1667 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/subtextpart/save-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/subtextpart/save-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/subtextpart/save-method/llms-full.txt

---

### Description

Saves the subtextpart's text with the specified format.

### Syntax

#### Save(out byte\[\], BinaryStreamType)

Saves the subtextpart's text in a byte array with the specified format.

```csharp
public void Save(out byte[] binaryData, BinaryStreamType binaryStreamType);
```

```vbnet
Public Sub Save(ByRef binaryData As Byte(), binaryStreamType As BinaryStreamType)
```

| Parameter | Description |
|---|---|
| binaryData | Specifies a byte array into which the subtextpart's text is saved. No memory needs to be allocated through the caller. |
| binaryStreamType | Specifies one of the [BinaryStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/binarystreamtype/enumeration/llms-full.txt) values. |

#### Save(out string, StringStreamType)

Saves the subtextpart's text as a string with the specified format.

```csharp
public void Save(out string stringData, StringStreamType stringStreamType);
```

```vbnet
Public Sub Save(ByRef stringData As String, stringStreamType As StringStreamType)
```

| Parameter | Description |
|---|---|
| stringData | Specifies a string into which the subtextpart's text is saved. No memory needs to be allocated through the caller. |
| stringStreamType | Specifies one of the [StringStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/stringstreamtype/enumeration/llms-full.txt) values. |

#### Save(out byte\[\], BinaryStreamType, SaveSettings)

Saves the subtextpart's text in a byte array with the specified format and special settings.

```csharp
public void Save(out byte[] binaryData, BinaryStreamType binaryStreamType, SaveSettings saveSettings);
```

```vbnet
Public Sub Save(ByRef binaryData As Byte(), binaryStreamType As BinaryStreamType, saveSettings As SaveSettings)
```

| Parameter | Description |
|---|---|
| binaryData | Specifies a byte array into which the subtextpart's text is saved. No memory needs to be allocated through the caller. |
| binaryStreamType | Specifies one of the [BinaryStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/binarystreamtype/enumeration/llms-full.txt) values. |
| saveSettings | Specifies a [SaveSettings](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/savesettings/llms-full.txt) object with additional information and settings for the save operation. |

#### Save(out string, StringStreamType, SaveSettings)

Saves the subtextpart's text as a string with the specified format and special settings.

```csharp
public void Save(out string stringData, StringStreamType stringStreamType, SaveSettings saveSettings);
```

```vbnet
Public Sub Save(ByRef stringData As String, stringStreamType As StringStreamType, saveSettings As SaveSettings)
```

| Parameter | Description |
|---|---|
| stringData | Specifies a string into which the subtextpart's text is saved. No memory needs to be allocated through the caller. |
| stringStreamType | Specifies one of the [StringStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/stringstreamtype/enumeration/llms-full.txt) values. |
| saveSettings | Specifies a [SaveSettings](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/savesettings/llms-full.txt) object with additional information and settings for the save operation. |

### Examples

The following example marks the selected customer name as a named document region by using `SubTextPart.Save`.

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
SubTextPart subTextPart = new("CustomerName", 10);
textControl.SubTextParts.Add(subTextPart);

string stringData = @"{\rtf1\ansi Sample document}";
subTextPart.Save(out stringData, StringStreamType.RichTextFormat);
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim subTextPart As New SubTextPart("CustomerName", 10)
textControl.SubTextParts.Add(subTextPart)

Dim stringData As String = "{\rtf1\ansi Sample document}"
subTextPart.Save(stringData, StringStreamType.RichTextFormat)
```

---

## Nearby

- **Previous:** [SubTextPart.OuterSubTextPart Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/subtextpart/outersubtextpart-property/llms-full.txt)
- **Next:** [SubTextPart.ScrollTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/subtextpart/scrollto-method/llms-full.txt)
