DS Server

Javascript: TXTextControl.appendDocument Method

Method|Introduced in 25.0

Description

Appends text in a certain format to the current document.

Syntax

<void> TXTextControl.appendDocument(<StreamType> streamType, <string> base64Data)

Parameters

ParameterDescription
streamType

Specifies one of the numerical StreamType values.

base64Data

Base64 encoded document data. For encoding strings containing characters outside of the Latin1 range use TXTextControl.btoaUTF8.

Examples

The following example shows how to append a short HTML snippet to the current document in the web editor.

var html = "<h3>This is some <em>HTML</em> text. Стоял он, дум великих полн, И вдаль глядел.</h3>";
var encoded = TXTextControl.btoaUTF8(html);
TXTextControl.appendDocument(TXTextControl.StreamType.HTMLFormat, encoded);

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

TXTextControl.appendDocument(
    TXTextControl.StreamType.HTMLFormat,
    "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAFgAH/qbPzWQAAAABJRU5ErkJggg=="
);