# Javascript: TXTextControl.saveSelection Method

> Obsolete. This method will be removed in one of the next versions. Saves the current selection in a certain format and sends the result back asynchronously by calling a given callback function.

> **Note:** This is deprecated and should not be used in new work.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 23.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: TXTextControl.saveSelection Method
- **435 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/saveselection-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/saveselection-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/saveselection-method/llms-full.txt

---

### Description

`Obsolete. This method will be removed in one of the next versions.` Saves the current selection in a certain format and sends the result back asynchronously by calling a given callback function.

### Syntax

```javascript
<void> TXTextControl.saveSelection(<StreamType> streamType, <SaveDocumentResultCallback> callback)
```

### Parameters

| Parameter | Description |
|---|---|
| streamType | Specifies one of the [StreamType](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/streamtype-enumeration/llms-full.txt) values. |
| callback | A function with one parameter. Is called with an argument object of type [SaveDocumentResult](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/savedocumentresult/llms-full.txt) containing the selection content after the selection has been saved successfully. |

### Examples

For an example on how to use this function have a look at the description of the [saveDocument](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/save-method/llms-full.txt) function.

The following example demonstrates `TXTextControl.saveSelection` in a practical document-editing workflow. Obsolete. This method will be removed in one of the next versions. Saves the current selection in a certain format and sends the result back asynchronously by calling a given callback function.

```javascript
TXTextControl.saveSelection(
    TXTextControl.StreamType.HTMLFormat,
    function(args) {
        if (!args) {
            console.warn("No save document result was returned.");
            return;
        }
        
        console.log("save selection result:", args);
    }
);
```

---

## Nearby

- **Previous:** [Javascript: TXTextControl.saveDocumentQuestionDialogEnabled Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/savedocumentquestiondialogenabled-property/llms-full.txt)
- **Next:** [TXTextControl.SaveSettings Object](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol-savesettings/llms-full.txt)
