4 Replies Latest reply on Oct 13, 2015 5:47 AM by devsel

    Text Frame - Applied Paragraph Style

    devsel

      Hi All,

      I need to modification the text frame based on applied paragraph style. Kindly help for this.

       

      Screen shot 2015-10-13 at 1.50.04 PM.png

       

       

      Please correct my code

       

      var myDoc = app.activeDocument;   

      var myPstyles = app.activeDocument.allParagraphStyles;  

      var myMissingStyle = new Array;

      for(i=2; i<myPstyles.length; i++){   

          var myS =myPstyles[i].name;   

              myMissingStyle.push(myS)

          } 

       

      var _d = myDoc; 

      var _allStories = _d.stories; 

       

      for(var n=_allStories.length-1;n>=0;n--){ 

              var _storyAllTextFrames = _allStories[n].textContainers; 

           

              for(var m=_storyAllTextFrames.length-1;m>=0;m--){ 

                  if (_storyAllTextFrames[m].appliedParagraphStyle.name == myMissingStyle)//Error here

                  {

                      alert("Available")

      //~                 _storyAllTextFrames[m].strokeColor = app.activeDocument.swatches.item("Black"); 

                      }

                  }; 

              }; 

           

       

       

      Regards,

      Dev

        • 1. Re: Text Frame - Applied Paragraph Style
          Jump_Over Level 5

          ...

          I need to modification the text frame based on applied paragraph style. Kindly help for this.

          ...

           

          Hi,

           

          Can't see any chance to work for your code ==> the reason is THERE S NO SUCH PROPERTY AS textFrame.appliedParagraphStyle.

           

          Can't see your goal, as well ==> to tell you the truth

           

          Jarek

          • 2. Re: Text Frame - Applied Paragraph Style
            devsel Level 1

            Hi Jerak,

            I have taking the responsibility to get styled word doc from the InDesign application (final files). In application, some of the text frames applied paragraph style directly (see 1st screenshot below). While extracting to word, the original font style changed (some functions used to clear styles, nested retain etc...). So, i'm trying to apply color for those frames (separate application for identification purpose) only for user identification.

             

            Here is some sample:

             

            Screen shot 2015-10-13 at 4.00.04 PM.pngSelecting tool used on frame --> then applied the paragraph style - this is an issue:

            Screen shot 2015-10-13 at 1.50.04 PM.png

             

            This is correct method - no issue for this frame:

            Screen shot 2015-10-13 at 3.43.32 PM.png

             

            Word doc - error:

            Screen shot 2015-10-13 at 3.55.04 PM.png

             

            Word doc - correct:

            Screen shot 2015-10-13 at 3.56.10 PM.png

             

            This is my goal.

             

             

             

             

             

             

             

             

             

             

            Kindly let me know if not clear my request.

             

             

             

            Dev.

            • 3. Re: Text Frame - Applied Paragraph Style
              Vamitul Level 4

              Is

              "if (_storyAllTextFrames[m].paragraphs[0].appliedParagraphStyle.name == myMissingStyle)"

              what you are looking for?


              • 4. Re: Text Frame - Applied Paragraph Style
                devsel Level 1

                Hi Vamitul,

                Not exactly, kind check the below case.

                 

                 

                 

                 

                 

                 

                In beginning, the text frame applied paragraph style then overrode:

                Screen shot 2015-10-13 at 6.11.27 PM.png

                 

                 

                Once clear overrides, display in original style (bold as per style)

                Screen shot 2015-10-13 at 6.12.17 PM.png

                 

                The both of occurrences are wrong as per our norms.

                 

                 

                 

                So, we must accept only '(no style)'. Other than, need to report (above kind of examples).

                Screen shot 2015-10-13 at 6.15.35 PM.png

                 

                 

                Thanks for checking.

                Dev.