2 Replies Latest reply on Aug 15, 2011 12:36 PM by RichardM0701

    How to Referance Paragraph Style Groups in Code?

    RichardM0701

      How do you reference a paragraph style group in front a paragraph style in the code? My paragrapgh style "Heading 1" is in a group called "Headings".

       

       

      myStyle = app.activeDocument.paragraphStyles.item("Heading 1");
      myStyle.appliedFont = "Microsoft JhengHei";
      
      

        Region Capture.png

        • 1. Re: How to Referance Paragraph Style Groups in Code?
          secondgradersrule

          Richard:

           

          I construct a lot of Indesign Tagged Text files, and this is an example of what I stick at the beginning of the line when the style sits in a group.  The style name is "AGBoldCtr" and it sits in group "xSports."

           

          <pstyle:xSports\:AGBoldCtr>American League

           

          In code, I create a variable for a style in a group like this:

           

          var PPHead = app.activeDocument.paragraphStyleGroups.item("xSports").paragraphStyles.item("AGPPHead");

           

          Then I assign variable PPHead to a paragraph as in:

           

          app.activeDocument.selection[0].paragraphs[iLoop].appliedParagraphStyle= PPHead;      //

           

           

          Dick Conrad

          • 2. Re: How to Referance Paragraph Style Groups in Code?
            RichardM0701 Level 1

            Thank you Mr. Conrad,

             

            The code ended up like this and works perfect thanks to the code you supplied:

            myStyle = app.activeDocument.paragraphStyleGroups.item("Headings").paragraphStyles.item("Heading 1");
            myStyle.appliedFont = "Microsoft JhengHei";
            

             

            thanks again!

             

            Rich