DS Server

Javascript: FormattingStyle.apply Method

Method|Introduced in 28.0

Description

Applies all set attributes of the style to the current document.

Syntax

<void> FormattingStyle.apply([<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Optional. Is called when the operation completed.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates FormattingStyle.apply in a practical document-editing workflow. Applies all set attributes of the style to the current document.

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

function apply(formattingStyle) {
    formattingStyle.apply(
        function() {
            console.log("apply completed.");
        },
        onTxError
    );
}