Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to center text with Javascript?

New Here ,
Dec 06, 2021 Dec 06, 2021

Hello all. 

 

I am trying to center align the text inside my text frame with javascript, but couldn't find much documentation.

 

I found "StrokeAlign" property in the documentation but there is no good example how to use it.

 

indesigncenter.pngexpand image

 

 

I found the feature inside indesign (selected with red box) but not sure how to proceed

TOPICS
Scripting
476
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 06, 2021 Dec 06, 2021

 

app.selection[0].justification = Justification.CENTER_ALIGN;

 

The justification property is found on Text, Word, Paragraph, ParagraphStyle, Character, Line, TextStyleRange, InsertionPoint and a few others: https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Justification.html

Translate
Community Expert ,
Dec 06, 2021 Dec 06, 2021
LATEST

 

app.selection[0].justification = Justification.CENTER_ALIGN;

 

The justification property is found on Text, Word, Paragraph, ParagraphStyle, Character, Line, TextStyleRange, InsertionPoint and a few others: https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Justification.html

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines