# Javascript: TXTextControl.append Method

> Appends text to the document in a certain format.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 31.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TXTextControl.append Method
- **595 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/append-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/append-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/append-method/llms-full.txt

---

### Description

Appends text to the document in a certain format.

### Syntax

```javascript
<void> TXTextControl.append(<StreamType> streamType, <string> base64Data, <LoadDocumentCallback> callback, <LoadSettings> loadSettings, <AppendSettings> appendSettings, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| streamType | Specifies one of the numerical [StreamType](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/streamtype-enumeration/llms-full.txt) values. |
| base64Data | Base64 encoded document data. For encoding strings containing characters outside of the Latin1 range use [TXTextControl.btoaUTF8](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/btoautf8-method/llms-full.txt). |
| callback | Receives information about the appended data when the appending process is finished. |
| loadSettings | Additional settings for appending the data. Can be null. |
| appendSettings | Settings on how the document is appended. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TXTextControl.append` in a practical document-editing workflow. Appends text to the document in a certain format.

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.append(
    TXTextControl.StreamType.HTMLFormat,
    "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAFgAH/qbPzWQAAAABJRU5ErkJggg==",
    function(result) {
        if (!result) {
            console.warn("No load document callback data was returned.");
            return;
        }
        
        console.log("append result:", result);
    },
    { loadImages: true, loadHypertextLinks: true },
    TXTextControl.AppendSettings.StartWithNewParagraph,
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: TXTextControl.addTextField Method](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/addtextfield-method/llms-full.txt)
- **Next:** [Javascript: TXTextControl.appendDocument Method](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/appenddocument-method/llms-full.txt)
