Javascript: InlineStyleCollection.getItem Method
Description
Gets a style from the collection by the style's name.
Syntax
<void> InlineStyleCollection.getItem(<String> styleName, <RequestInlineStyleCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| styleName | Specifies the style's name. |
| callback | Receives the style if available. Otherwise null. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates InlineStyleCollection.getItem in a practical document-editing workflow. It gets a style from the collection by the style's name.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.inlineStyles.getItem(
"Heading 1",
function(style) {
if (!style) {
console.warn("No inline style was returned.");
return;
}
console.log("get item result:", style);
},
onTxError
);