Javascript: Selection.getBaseline Method
Description
Gets the baseline alignment, in twips, of the selected text. Takes a callback function as a parameter which is called with the baseline alignment, in twips, of the selected text. Positive values moves the baseline to superscript, negative values move the baseline to subscript.
Syntax
<void> Selection.getBaseline(<RequestNumberCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the baseline alignment, in twips, of the selected text. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates Selection.getBaseline in a practical document-editing workflow. It gets the baseline alignment, in twips, of the selected text. Takes a callback function as a parameter which is called with the baseline alignment, in twips, of the selected text. Positive values moves the baseline to superscript, negative values move the baseline to subscript.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.selection.getBaseline(
function(result) {
console.log("get baseline result:", result);
},
onTxError
);