4 Replies Latest reply on Mar 2, 2013 4:29 AM by Jump_Over

    How I apply PStyle to previous para -cs3

    shilpa25 Level 1

      Hi Forum,


      I have 3 paragraphs for example..


      first 2 paras are in same style.... let assume.. bullet style.

      the last para style is H1style.

      now i need to applied style H2 only for the second para.. (which is currently in bullet style).


      para 1 should left as is...


      I tried this one. but it is renaming the style name as H2 and not applying...(style bullet should be renamed).

      can anyone advise me.


      myDoc = app.activeDocument;

      for (j = myDoc.stories.length - 1; j >= 0; j--) {

          myStory = myDoc.stories.item(j);

          myParas = myStory.paragraphs;

      //    if (myParas.length > 5) {

              for (i = 0; i <myStory.paragraphs.length;  i++) {

                  if (myStory.paragraphs[i].appliedParagraphStyle.name == "bullet") {

      myStory.paragraphs[i+1].appliedParagraphStyle.name = "H1";



      thanks and regards..