changing formatting using mailmerge

I am making a set of id cards with participant’s name and details on it (in writer). Participants are grouped into a dozen categories based on their choices during registration. All these info are available as an ODS spreadsheet file. I want to change the background color of the id card based on the each person’s group. The color can be made available as an additional column (in words or as hex format) in the ODS spread sheet.

Is there a way I can use mail merge to set the background color of the page or a table based on a field in the record?

I believe that what you want to achieve is only possible using several mail merge templates (with required settings), and then doing mail merge on a subset (filtered set) of records.

Thanks. I ended up doing this. I will wait for any other options before accepting this as an answer.