Loads text in a certain format. The complete contents of the web editor are replaced.

Introduced: X13.

<void> TXTextControl.loadDocument(<StreamType> streamType, <string> base64Data, <LoadDocumentCallback> callback, [<LoadSettings> loadSettings], [<ErrorCallback> errorCallback])


Parameter Description
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.
callback Receives information about the loaded data when the loading is finished.
loadSettings Optional. Additional settings for loading the data.
errorCallback Optional. Is called when the operation failed with an error.


The following example shows how to load a short HTML document into the web editor.

var html = "This is some <b>HTML</b> text.";

var encoded = btoa(html); // btoa base-64-encodes strings.

TXTextControl.loadDocument(TXTextControl.StreamType.HTMLFormat, encoded);

Further Reading

Learn more about the Javascript: TXTextControl.loadDocument Method in the Text Control Blog: