Skip to main content
Inspiring
May 28, 2014
Question

need script for apply paragraph style

  • May 28, 2014
  • 1 reply
  • 539 views

Hi,

I want to apply the "next paragraph style" to previous paragraph".

For instrance:

line 1: H1 style

line 2: H2 style

line 3: H3 style.

Now I want to apply 'line 3' style to 'line 2'. Is this possible by script?

by

hasvi

This topic has been closed for replies.

1 reply

Chinnadk
Legend
May 28, 2014

Hi Hasvi,

Try this.

var

    doc = app.activeDocument,

    h1 = doc.paragraphStyles.item("H1"),

    h2 = doc.paragraphStyles.item("H2"),

    h3 = doc.paragraphStyles.item("H3");

h1.nextStyle = h2;

h2.nextStyle = h3;

Regards,

Chinna

hasviAuthor
Inspiring
May 28, 2014

Hi Chinna,

Here H2(Next Style option) applied in H1 paragraph style option after the 'Based On' box.

Not applied directly H2 instead of H1.

by

hasvi

Chinnadk
Legend
May 28, 2014

var

    doc = app.activeDocument,

    h1 = doc.paragraphStyles.item("H1"),

    h2 = doc.paragraphStyles.item("H2"),

    h3 = doc.paragraphStyles.item("H3");

h2.nextStyle = h3;