# Selection.Load Method

> Exchanges the currently selected text with text in a certain format.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 22.0
- **Namespace:** `TXTextControl.Web`
- **Package:** `TXTextControl.Web` (assembly `TXTextControl.Web.DocumentEditor.dll`, from nuget.org, the private NuGet feed or Text Control Offline Packages)
- **Path:** TX Text Control .NET Server > Reference > TXTextControl.Web > Selection.Load Method
- **1203 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/selection/load-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/selection/load-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/selection/load-method/llms-full.txt

---

### Description

Exchanges the currently selected text with text in a certain format.

### Syntax

#### Load(string, StreamType)

Exchanges the currently selected text with text in the specified format. The new text is read from the specified file.

```csharp
public void Load(string path, StreamType streamType);
```

```vbnet
Public Sub Load(path As String, streamType As StreamType)
```

| Parameter | Description |
|---|---|
| path | Specifies a file from which the data is loaded. |
| streamType | Specifies one of the [StreamType](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/streamtype/enumeration/llms-full.txt) values. |

#### Load(FileStream, StreamType)

Exchanges the currently selected text with text in the specified format. The new text is read from the specified file stream.

```csharp
public void Load(FileStream fileStream, StreamType streamType);
```

```vbnet
Public Sub Load(fileStream As FileStream, streamType As StreamType)
```

| Parameter | Description |
|---|---|
| fileStream | Specifies a file from which the data is loaded. The data is loaded from the stream's current position. |
| streamType | Specifies one of the [StreamType](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/streamtype/enumeration/llms-full.txt) values. |

#### Load(byte\[\], BinaryStreamType)

Exchanges the currently selected text with text in the specified format. The new text is read from the specified byte array.

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

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

| Parameter | Description |
|---|---|
| binaryData | Specifies a byte array from which the data is loaded. |
| binaryStreamType | Specifies one of the [BinaryStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/binarystreamtype/enumeration/llms-full.txt) values. |

#### Load(string, StringStreamType)

Exchanges the currently selected text with text in the specified format. The new text is read from the specified string.

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

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

| Parameter | Description |
|---|---|
| stringData | Specifies a string from which the data is loaded. |
| stringStreamType | Specifies one of the [StringStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/stringstreamtype/enumeration/llms-full.txt) values. |

### Examples

The following example uses `Selection.Load` in a document-processing workflow.

```csharp
selection.Load(@"App_Data\document.docx", TXTextControl.Web.StreamType.PlainAnsiText);
Console.WriteLine("Load completed for the Selection workflow.");
```

```vbnet
selection.Load("App_Data\document.docx", TXTextControl.Web.StreamType.PlainAnsiText)
Console.WriteLine("Load completed for the Selection workflow.")
```

---

## Nearby

- **Previous:** [Selection.Length Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/selection/length-property/llms-full.txt)
- **Next:** [Selection.Save Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/selection/save-method/llms-full.txt)
