7 Replies Latest reply on Jun 28, 2010 11:13 PM by Oviya...

    Apply Paragraph style

    Oviya... Level 1

      Hai Friends..

                          how to use the Apply "ParaStyle"... This option will come ith paragraphstyle pallete. if  you will select one style and give right click means  we can see this option as ***Apply "Para"***.but how  to use this propertiy in our java script for InDesign CS4.

        • 1. Re: Apply Paragraph style
          Kasyan Servetsky Level 5

          text.applyParagraphStyle(someStyle, false);
          applies the paragraph style and doesn't remove overrides.

          Use "true" to delete the overrides, in which case you get the same results as
          text.appliedParagraphStyle = someStyle;

          • 2. Re: Apply Paragraph style
            Oviya... Level 1

            Hai Kasyan...

             

            Sorry yaar... applyParagraphStyle is not working. it was showing error as invalid value for parameter 'using' of event 'applyParagraphStyle'

            This is my code for InDesignCS4.

             

            app.findTextPreferences = NothingEnum.nothing;
            app.findTextPreferences.appliedParagraphStyle = "CodeSnippet";
            var sear = app.activeDocument.findText();

             

            for(cn=sear.length-1; cn>=0; cn--)
            {
                //sear[cn].appliedParagraphStyle = "CodeSnippet";
                sear[cn].applyParagraphStyle("CodeSnippet", true);
            }

             

            Please give solution for this problem..

            • 3. Re: Apply Paragraph style
              Anil Yadav Level 1

              Hi Oviya,

               

              The overall code is looking correct to me except defining the Paragraph Style. I have modified the code as per your requirement. Hope this help...

               

               

              app.findTextPreferences = NothingEnum.nothing; 
              app.findTextPreferences.appliedParagraphStyle = "CodeSnippet";
              myParaStyle=app.activeDocument.paragraphStyles.item("CodeSnippet");
              var sear = app.activeDocument.findText(); 
               
              for(cn=sear.length-1; cn>=0; cn--)
              {
                  //sear[cn].appliedParagraphStyle = "CodeSnippet";
                  sear[cn].applyParagraphStyle(myParaStyle, true); 
              }
              


              Thanks,

              Anil Yadav

              • 4. Re: Apply Paragraph style
                Oviya... Level 1

                Sorry Anil..

                               This also not working...Actully my problem is

                               While ExportRTF from InDesignCS4 some styles are changed in RTF file. For that i have to do ApplyStyle option. If I choosed ApplyStyle for the same style means it will reflect correctly..... Thats why before exporting Im using ApplyStyle..

                • 5. Re: Apply Paragraph style
                  Anil Yadav Level 1

                  The above code is woking perfectly..I have tested it before sending.

                   

                  Could you please suggest what message or error you are facing while running the same.

                   

                  Or there might be somthing fishy in the InDesign Document's Paragraph Style. Could you send me the InDesign document.

                   

                  Thanks,

                  Anil Yadav

                  • 6. Re: Apply Paragraph style
                    Oviya... Level 1

                    app.findTextPreferences = NothingEnum.nothing;
                    app.findTextPreferences.appliedParagraphStyle = "CodeSnippet";
                    myParaStyle=app.activeDocument.paragraphStyles.item("CodeSnippet");
                    var sear = app.activeDocument.findText();

                    for(cn=sear.length-1; cn>=0; cn--)
                    {
                        sear[cn].applyParagraphStyle(myParaStyle, true);
                    }

                     

                    This code is working fine but not yet i rectified my main problem.

                    My goal is Export RTF file...

                     

                    While ExportRTF from InDesignCS4 some styles are changed in RTF file. For that i have to do ApplyStyle option. If I choosed ApplyStyle for the same style means it will reflect correctly..... Thats why before exporting Im using ApplyStyle..

                    • 7. Re: Apply Paragraph style
                      Anil Yadav Level 1

                      Send me an example InDesign Document for that. Only after that, I may be help you.