Skip to main content
jan99x
Inspiring
May 30, 2020
Answered

align text right in textframe (in script)

  • May 30, 2020
  • 1 reply
  • 2771 views

Hi,

(scripting)

a) How align text in textframe to the Right?

This topic has been closed for replies.
Correct answer Manan Joshi

Run the following code with a selected textframe

app.selection[0].parentStory.justification = Justification.RIGHT_ALIGN

 

If right justified is needed then use the following value for assignment 

Justification.RIGHT_JUSTIFIED

 

The different values that can be used are mentioned in the following link

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Story.html

 

-Manan

1 reply

Manan JoshiCommunity ExpertCorrect answer
Community Expert
May 30, 2020

Run the following code with a selected textframe

app.selection[0].parentStory.justification = Justification.RIGHT_ALIGN

 

If right justified is needed then use the following value for assignment 

Justification.RIGHT_JUSTIFIED

 

The different values that can be used are mentioned in the following link

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Story.html

 

-Manan

-Manan
brian_p_dts
Community Expert
Community Expert
May 30, 2020

Note that Manan's solution would do the alignment to every paragraph is all text frames linked to the text frame in question. If you just want to hit the paragraphs in a specific text frame, with the frame selected: 

app.selection[0].paragraphs.everyItem().justification = Justification.RIGHT_ALIGN;

 

TestriteVisual
Inspiring
March 31, 2023

Just what I needed, thank you!! I used the center align version so

MyTextBox.parentStory.justification = Justification.CENTER_ALIGN;