# Save Method

> Saves the document or selection to a file at an offset in formats such as TX, ANSI or Unicode text, HTML, RTF, DOC, DOCX, XML, CSS, PDF and PDF/A.

- **Product:** TX Text Control ActiveX
- **Section:** Documentation
- **Kind:** Method
- **Path:** TX Text Control ActiveX > API Reference > TXTextControl > Save Method
- **632 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/save-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/save-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/save-method/llms-full.txt

---

Saves data in a file with a specified format.

### Syntax

```vbscript
TXTextControl.Save FileName[, Offset[, Format[, CurSelection]]]
```

### Parameters

| Parameter | Description |
|---|---|
| FileName | Specifies the file to save in. |
| Offset | Optional. Specifies the file position to where the data is to be written when the data of more than one Text Control are to be saved. When not specified or set to -1 the data is appended. |
| Format | Optional. Specifies a format identifier. When this parameter is not specified the data is saved in the internal Text Control format (3). Otherwise it can be one of the following values: |
| CurSelection | Optional. When set to True the current selection is saved. When omitted or set to False or when no selection exists all the control contents are saved. This parameter must be set to False if the saving format is XML (10), CSS (11), AdobePDF (12) or AdobePDF/A (14). |

#### Format

| Constant | Description |
|---|---|
| 1 - ANSI text | Text in Windows ANSI format (an end of a paragraph is marked with the control characters 13 and 10). |
| 2 - TX text | Text in ANSI format (an end of a paragraph is marked only with the control character 10). |
| 3 - TX | Text including formatting attributes in the internal Text Control format. Text is stored in ANSI. |
| 4 - HTML | HTML format (Hypertext Markup Language). |
| 5 - RTF | RTF format (Rich Text Format). |
| 6 - Unicode text | Text in Windows Unicode format (an end of a paragraph is marked with the control characters 13 and 10). |
| 7 - TX text | Text in Unicode format (an end of a paragraph is marked only with the control character 10). |
| 8 - TX | Text including formatting attributes in the internal Text Control format. Text is stored in Unicode. |
| 9 - Microsoft Word 97-2003 | Microsoft Word 97-2003 format (\*.doc). |
| 10 - XML | XML format (Extensible Markup Language). |
| 11 - CSS | CSS format (Cascading Style Sheet). |
| 12 - Adobe PDF | Adobe Portable Document Format (PDF). |
| 13 - Microsoft Word | Microsoft Word format (\*.docx). |
| 14 - Adobe PDF/A | Adobe Portable Document Format Archive (PDF/A). |

### Return Value

The method returns the position in the file behind the saved data. It is zero if the data could not be saved.

### Data Types

| Name | Data type |
|---|---|
| FileName | String |
| Offset | Long |
| Format | Integer |
| CurSelection | Boolean |
| Return value | Long |

### See Also

- [PDF Export](https://docs.textcontrol.com/tx-text-control-activex/pdf/llms-full.txt)
- [Load Method](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/load-method/llms-full.txt)
- [Programming Category: Loading, Saving and Database Support](https://docs.textcontrol.com/tx-text-control-activex/reference/categories/load-save/llms-full.txt)

---

## Nearby

- **Previous:** [RulerHandle Property](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/rulerhandle-property/llms-full.txt)
- **Next:** [SaveDialog Method](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/savedialog-method/llms-full.txt)
