Skip to main content
Inspiring
May 20, 2025
Répondu

How to apply paragraph then next style as a query or GREP?

Hi. I'm testing using the Multi-Find/Change plug-in in my documents to apply about a dozen queries in one go. But there's one stage I've been doing manually which I can't figure out how to represent as a GREP or query, meaning I can't include it in the set of queries to apply.

Basically during the process I'd select the first line of text, and right-click on the appropriate paragraph style and select 'Apply "xxx" style then next syle'. How can this be represented as a query or GREP please? Or even apply first style then next, as I know the name of the style would need to be specified somewhere. Thanks!

Meilleure réponse par defaults2aq0czkx4gl

Thanks Barb - I'll take a look, although it does just appear to be a seperate stage just like opening the para styles and applying the first one?

The closest I can get using a find/change or GREP is to find the first style I know needs to change (which is a simple SKU of six numbers with a space in between ie ^9^9^9 ^9^9^9 or GREP $1 $2) and apply the correct style, but even though there is a next style assigned to that it won't apply it via search, only by doing it manually through the paragraph style pane.

3 commentaires

Willi Adelberger
Community Expert
Community Expert
May 20, 2025

You can define and apply it with an object style.

Barb Binder
Community Expert
Community Expert
May 20, 2025

Hi @defaults2aq0czkx4gl:

 

This may or may not be helpful but I handle this via a free script created by one of our fellow Adobe Community Experts, @TaW and available here: https://www.id-extras.com/indesign-quick-apply-with-next-style/.

 

Similarly to you, I start new documents by running a series of queries in a FindChangebyList script, and then I run this one. I'll be curious to see if we can both combine this into a single task. 

 

~Barb

~Barb at Rocky Mountain Training
defaults2aq0czkx4glAuteurRéponse
Inspiring
May 21, 2025

Thanks Barb - I'll take a look, although it does just appear to be a seperate stage just like opening the para styles and applying the first one?

The closest I can get using a find/change or GREP is to find the first style I know needs to change (which is a simple SKU of six numbers with a space in between ie ^9^9^9 ^9^9^9 or GREP $1 $2) and apply the correct style, but even though there is a next style assigned to that it won't apply it via search, only by doing it manually through the paragraph style pane.

Robert at ID-Tasker
Legend
May 20, 2025

I don't think it's possible through GREP. 

 

But it can be scripted - most likely a single invoke() should work.