Javascript: TextFrame.getAlignment Method
Description
Gets the frame's horizontal alignment when it is anchored to a paragraph.
Syntax
<void> TextFrame.getAlignment(<RequestHorizontalAlignmentCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the current property value. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates TextFrame.getAlignment in a practical document-editing workflow. It gets the frame's horizontal alignment when it is anchored to a paragraph.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function inspectAlignment(textFrame) {
textFrame.getAlignment(
function(alignment) {
if (!alignment) {
console.warn("No horizontal alignment was returned.");
return;
}
console.log("get alignment result:", alignment);
},
onTxError
);
}