Skip to main content
Sayed Ali Mousawi
Known Participant
June 30, 2019
Answered

Change paragraph style option for all paragraph styles

  • June 30, 2019
  • 2 replies
  • 1755 views

Hi guys,

How can i change an item in paragraph style option, not just for one paragraph style but for all paragraph styles in the document.

for example:

i want to set "align to grid" for all paragraph styles in my document to "none".

regards.

This topic has been closed for replies.
Correct answer Jongware

Loop over every style using the script developed in this thread: Detailed font change in paragraph styles

As it is, it changes the font, so check the documentation for what property you want to change: https://www.indesignjs.de/extendscriptAPI/indesign-latest/#ParagraphStyle.html

The top property is "alignToBaseline", and if you might have changed something to First Line Only, set gridAlignFirstLineOnly to false as well.

2 replies

Participating Frequently
January 4, 2021

i want to check whether "align to grid"options enable or not for all paragraph styles in my document

Participating Frequently
January 4, 2021

Hi,

 

How to check "Align To Grid" options used in paragraphStyles.

How to use "gridAlignment" property.

var myDoc =app.activeDocument
for(var ps=2;ps<myDoc.paragraphStyles.length;ps++){
  if(myDoc.paragraphStyles[ps].gridAlignment!=1852796517){ //GridAlignment.NONE
     alert(myDoc.paragraphStyles[ps].name);
 }
}

 

I used like this but i get an error. Please mention how to use "gridAlignment" in paragraph Style

Jongware
Community Expert
JongwareCommunity ExpertCorrect answer
Community Expert
June 30, 2019

Loop over every style using the script developed in this thread: Detailed font change in paragraph styles

As it is, it changes the font, so check the documentation for what property you want to change: https://www.indesignjs.de/extendscriptAPI/indesign-latest/#ParagraphStyle.html

The top property is "alignToBaseline", and if you might have changed something to First Line Only, set gridAlignFirstLineOnly to false as well.

Sayed Ali Mousawi
Known Participant
June 30, 2019

thank you..

this is my code:

for (var i=2; i<app.activeDocument.paragraphStyles.length; i++)

{

  app.activeDocument.paragraphStyles.gridAlignment = GridAlignment.NONE;

}

Participating Frequently
January 4, 2021

Hi Sayed,

 

i want to check whether "align to grid"options enable or not for all paragraph styles in my document