Javascript: ParagraphStyleCollection.getItem Method
Description
Gets a style from the collection by the style's name.
Syntax
<void> ParagraphStyleCollection.getItem(<String> styleName, <RequestParagraphStyleCallback> 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 ParagraphStyleCollection.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.paragraphStyles.getItem(
"Heading 1",
function(style) {
if (!style) {
console.warn("No paragraph style was returned.");
return;
}
console.log("get item result:", style);
},
onTxError
);