Javascript: DocumentLink.getAutoGenerationType Method
Description
Gets the type of auto-generation. A document link in a table of contents is automatically generated when the table of contents is inserted into the document.
Syntax
<void> DocumentLink.getAutoGenerationType(<RequestNumberCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the document link's auto generation type. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates DocumentLink.getAutoGenerationType in a practical document-editing workflow. It gets the type of auto-generation. A document link in a table of contents is automatically generated when the table of contents is inserted into the document.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const documentLinks = mainText.documentLinks;
documentLinks.getItem(function(documentLink) {
if (!documentLink) {
console.warn("No document link is available at the current input position.");
return;
}
documentLink.getAutoGenerationType(
function(result) {
console.log("get auto generation type result:", result);
},
onTxError
);
}, onTxError);
}, onTxError);