3 Replies Latest reply on Jul 8, 2015 1:43 AM by Sudha K

    Move paragraph styles from style group

    Sudha K Level 1

      Hi,

       

        I want to move paragraph styles from paragraph style group to paragraph style pallete.  I am using the below code to do that.  Styles from style group is moved to out but showing inside of the style group. So  every item of paragraph style is return without moved style name.  It taken the last paragraph style as style group.

       

      test(app.activeDocument.paragraphStyleGroups);

      alert(app.activeDocument.paragraphStyles.length + " - " + app.activeDocument.paragraphStyles.everyItem().name)

       

      function test(sGrp)

          //try{

              for(var i = sGrp.length - 1; i >=0; i--)

              {

                  cstyleGrp = sGrp[i];                   

                  for(var j = cstyleGrp.paragraphStyles.length - 1; j >= 0; j--)

                  {

                      var cstylGrpStyle = cstyleGrp.paragraphStyles[j];           

                       cstylGrpStyle.move (LocationOptions.AT_END, app.activeDocument.paragraphStyles[app.activeDocument.paragraphStyles.length-1]);                   

                       //cstylGrpStyle.move (LocationOptions.AT_END, null);                  

                       //cstylGrpStyle.move (LocationOptions.AFTER, app.activeDocument.paragraphStyles[0]); 

                  }

                  if(cstyleGrp.paragraphStyleGroups.length > 0)

                  {

                      test(cstyleGrp.paragraphStyleGroups);

                  }

              }               

          //}catch(e){}

      }

       

      Screen shot 2015-07-07 at 2.02.08 PM.png

      Screen shot 2015-07-07 at 2.02.26 PM.png