Skip to main content
dublove
Legend
July 22, 2026
Answered

How to set the NextStyle option in the paragraph style properties?

  • July 22, 2026
  • 2 replies
  • 23 views

I used copying and created paragraph style B based on A, but found that NextStyle also changed to A.


At this point, I don't want to change it. I want to set it back to the same style, but I've been searching for a long time and haven't found any usable code.
How to set the next style to the same style in properties?

styleB.properties{


}

 

 

    Correct answer rob day
    var a = app.documents[0].paragraphStyles.itemByName('A');
    var b = a.duplicate()
    b.name = "B"
    b.nextStyle = b

    $.writeln(b.nextStyle.name)

     

     

     

    After run:

     

    2 replies

    dublove
    dubloveAuthor
    Legend
    July 22, 2026

    I thought there was a form like this:
    b.nextStyle=[‘same style’]

    It seems that I was naive.
     

    rob day
    Community Expert
    Community Expert
    July 22, 2026

    [‘same style’] would be a single item array—nextStyle is expecting a paragraphStyle not an array or string 

     

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

     

     

    rob day
    Community Expert
    rob dayCommunity ExpertCorrect answer
    Community Expert
    July 22, 2026
    var a = app.documents[0].paragraphStyles.itemByName('A');
    var b = a.duplicate()
    b.name = "B"
    b.nextStyle = b

    $.writeln(b.nextStyle.name)

     

     

     

    After run: