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

Use of currentParagraph.paragraphStyle with JSX

New Here ,
Jun 10, 2025 Jun 10, 2025

Hi, I try to change the paragraph style of a text using this function in jsx : currentParagraph.paragraphStyle = styleToApply; 

 

the style exists and no error appears but nothin happend. Somebody know why? I made a lot of tests during hours but i can't find the issue!

 

Thanks in advance.

 

Ludovic Schmidt

TOPICS
Scripting
273
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 , Jun 10, 2025 Jun 10, 2025

The syntax you're using is incorrect. You have to supply the paragraph to the paragraph style.

 

var idoc = app.activeDocument;

var myPara = idoc.paragraphStyles["myPara"]; // paragraph style name

var para0 = selection[0].textRange.paragraphs[0]; // selected text frame first paragraph 

myPara.applyTo(para0, true); // apply paragraph style to supplied paragraph
Translate
Adobe
Community Expert ,
Jun 10, 2025 Jun 10, 2025

The syntax you're using is incorrect. You have to supply the paragraph to the paragraph style.

 

var idoc = app.activeDocument;

var myPara = idoc.paragraphStyles["myPara"]; // paragraph style name

var para0 = selection[0].textRange.paragraphs[0]; // selected text frame first paragraph 

myPara.applyTo(para0, true); // apply paragraph style to supplied paragraph
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
New Here ,
Jun 10, 2025 Jun 10, 2025

Thanks for your help. What about character style? Are they working on the same way?

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
Community Expert ,
Jun 12, 2025 Jun 12, 2025

yes, use the same concept for applying character styles

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
New Here ,
Jun 18, 2025 Jun 18, 2025
LATEST

Thank you i will try it

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