Skip to main content
Participant
May 5, 2020
Answered

Grep to change background based on a word that is filled using data merge

  • May 5, 2020
  • 3 replies
  • 855 views

I am trying to use data merge to set up multiple items, but I need the background of each category to have a different color. In my example here I've got a column in my source file that designates PV for one category and D for another category. I need PV to always be a blue background with white text, D always needs to be a green background with white text. I've exhausted all of my searches to try to get a combination of Character Styles, Paragraph Rules & Styles, etc. Any thoughts? Thank you for your time.

This topic has been closed for replies.
Correct answer jason881

Thank you so much for the reply. Since posting this question I not only found a workaround, but the plan for the final design has since changed and will require a new approach. But to fill you in, my workaround was to just have two text boxes on top of one another. For the bottom text box I set a paragraph rule that applied the correct color via Character Style (PV was in blue and the paragraph rule was also blue). The top text box just set to white for character color in the Paragraph Style.

3 replies

Community Expert
May 5, 2020

Hi Michel,

that it can be done with GREP Styles is really no question, I think.

But we need some answers from the OP to suggest a good, or put better, a bullet-proof, workflow.

 

Regards,
Uwe Laubender

( ACP )

FRIdNGE
May 5, 2020

Grep style! … So just let the data play!

 

Sample:

 

 

(^/)  The Jedi

Community Expert
May 5, 2020

Hi Jason,

can you show your sample with hidden characters showing? Also frame edges showing?

That would make it easier to do some suggestions.

 

Are there any other data entries in the same category that start with a D followed by a blank?

Or a PV followed by a blank that should be colorized differently?

 

Are the entries done in table cells?

 

Regards,
Uwe Laubender

( ACP )

jason881AuthorCorrect answer
Participant
May 5, 2020

Thank you so much for the reply. Since posting this question I not only found a workaround, but the plan for the final design has since changed and will require a new approach. But to fill you in, my workaround was to just have two text boxes on top of one another. For the bottom text box I set a paragraph rule that applied the correct color via Character Style (PV was in blue and the paragraph rule was also blue). The top text box just set to white for character color in the Paragraph Style.