Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Only want Bold and Italic Words

$
0
0

Hi

I am using this code

        var doc =app.activeDocument;

         var par=doc.stories.everyItem().paragraphs.everyItem().getElements();

          var reportFilePath = doc.fullName.absoluteURI.replace(/\.indd$/i, ".txt");

          var len=par.length;

           

        

   for(var i=0;i<par.length;i++)

   {

      // var font=par[i].appliedParagraphStyle.name;

        //var font1=par[i].appliedFont.fullName;  

       var AllWords = par[i].words;

        var length=AllWords.length;

        for(var q=0;q<length;q++)

        {

         var size=AllWords[q].fontStyle;

            if(size=="Bold" || size=="Bold Italic" || size="Italic")

             {

                 WriteToFile(AllWords[q].contents,reportFilePath);            

             }

         }

      

    }

 

                function WriteToFile(text, reportFilePath) {

                file = new File(reportFilePath);

                file.encoding = "UTF-8";

                if (file.exists) {

                    file.open("e");

                    file.seek(0, 2);

                }

                else {

                    file.open("w");

                }

                  file.writeln(text); 

                file.close();

}

 

I want only bold italic words not any other digit and all

 

Some suggest


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>