Skip to main content
Participant
June 13, 2008
Question

Searching for an applied paragraph style (CS3 Javascript)

  • June 13, 2008
  • 1 reply
  • 278 views
Using CS3/Javascript, I am trying to iterate through all pages in a document, searching for any instances of text with a specific paragraph style applied ("Country") and, if an instance is found, grab the text that has this style applied. I have no problem with iterating through the pages, but I cannot for the life of me figure out the style search.

I have been trying to figure this out for a few days now and having searched this forum and tried multiple approaches I still cannot find the right way to do this. Any help would be greatly appreciated!

Thanks,

Dave
This topic has been closed for replies.

1 reply

Peter Kahrel
Community Expert
Community Expert
June 13, 2008
Maybe you should approach this from a different angle: instead of iterating through pages, do a document-wide search for your paragraph style:

app.findTextPreferences = null;
app.findTextPreferences.appliedParagraphStyle = 'Country';
f = app.activeDocument.findText();

Now f (an array) has all stretches of text that have your paragraph style applied to it.

Peter