5 Replies Latest reply on Sep 14, 2016 10:50 AM by Oriup

    Paragraph style in a group of styles

    James A L. Level 1

      How do you refer to a paragraph style that is in a group of styles?

       

      Here is the script:

       

      frm.paragraphs[0].appliedParagraphStyle = "Title";

       

      But the problem is that the style "Title" is in a group entitled "Headings" So how do I refer to it?

       

      Thanks.

        • 1. Re: Paragraph style in a group of styles
          Ten A Adobe Community Professional

          Hi
          When paragraphStyles in paragraphStyleGroup, paragraphStyles parent is paragraphStyleGroup.
          apply styles like below:

           

          var pStyleGroup = app.activeDocument.paragraphStyleGroups.itemByName('Headings');
          var titleStyle = pStyleGroup.paragraphStyles.itemByName('Title')
          frm.paragraphs[0].appliedParagraphStyle = titleStyle;

           

          Ten

          • 2. Re: Paragraph style in a group of styles
            James A L. Level 1

            Thanks, that was the answer I needed. I really appreciate it.

            • 3. Re: Paragraph style in a group of styles
              Oriup Level 1

              Hi Ten,

               

              Can you help me??

               

              My problem is how to find style groups style?

               

              My english is bad so please consider this.

               

              Example:

               

              app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

              app.findGrepPreferences.findWhat = "(.+?)";

              app.findGrepPreferences.appliedCharacterStyle = "TXT1:TXT1_FrutigerLTCom";

              app.changeGrepPreferences.appliedCharacterStyle ="TXT3:TXT3_STIXRegular";

              app.activeDocument.changeGrep();

              app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

               

              This is not working because of group of style.

              • 4. Re: Paragraph style in a group of styles
                Sajeev Sridharan Level 4

                Try this,

                 

                app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
                app.findGrepPreferences.findWhat = "(.+?)";
                app.findGrepPreferences.appliedCharacterStyle = app.activeDocument.characterStyleGroups.item("TXT1").characterStyles.item("TXT1_FrutigerLTCom");
                app.changeGrepPreferences.appliedCharacterStyle = app.activeDocument.characterStyleGroups.item("TXT3").characterStyles.item("TXT3_STIXRegular");
                app.activeDocument.changeGrep();
                app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
                
                1 person found this helpful
                • 5. Re: Paragraph style in a group of styles
                  Oriup Level 1

                  Thank you so much Sajeev Ji!

                   

                  It's working fine.