Javascript: TableOfContentsCollection.getItemByName Method
Description
Gets the table of contents with the specified name.
Syntax
<void> TableOfContentsCollection.getItemByName(<RequestTableOfContentsCallback> callback, [<ErrorCallback> errorCallback], <string> name)Parameters
| Parameter | Description |
|---|---|
| callback | Receives the requested table of contents or null if no table of contents with the specified name exists. |
| errorCallback | Optional. Is called when the operation failed with an error. |
| name | The table of contents' name. |
Examples
The following example demonstrates TableOfContentsCollection.getItemByName in a practical document-editing workflow. It gets the table of contents with the specified name.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function inspectItemByName(tableOfContentss) {
tableOfContentss.getItemByName(
function(toc) {
if (!toc) {
console.warn("No table of contents was returned.");
return;
}
console.log("get item by name result:", toc);
},
onTxError,
"QuarterlyReport"
);
}