7 Replies Latest reply on Jan 17, 2011 12:28 AM by Chang_indd

    Need to sort my paragraphStyleGroup


      Hi All,


      See my below script which does sort paragraph style. But I need to sort my Paragraph styles as well as my paragraph style group styles.


      Here is the code for sort paragraph styles:


      myParStyles_Sort (app.activeDocument);
      function myParStyles_Sort (doc)
          var string_array = sort_par_names (doc);
          for (var i = 0; i < string_array.length; i++)
              doc.paragraphStyles.item (string_array[i]).move (
                  LocationOptions.after, doc.paragraphStyles[i+2])

      function sort_par_names (doc)
        var array = doc.paragraphStyles.everyItem().name;
        array.shift (); array.shift ();
        return array.sort (myCaseInsensitive);
      function myCaseInsensitive (a, b)
        return a.toLowerCase() > b.toLowerCase()


      Here is current style sheets examples

      Picture 13.png


      Need to change in this format as indesign does with sort by name option.


      Picture 14.png


      Thanks in advance for your time and support.