Script to fill cell colors based on text in cell
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Script to fill cell colors based on text in cell
October 28, 2016 at 5:43 am #89389
Hi – I have a client who wants several tables built as “heat maps”. They have 20 colors, so we have 20 swatches, named 1 to 20.
The table has one number in each cell.
I need to fill each cell with the corresponding color.
I can easily format the text to “none” so it no longer appears. And, I can use Paragraph Shading and build 20 paragraph styles, all based on style 1, so that they fill the table cells and each style uses the appropriate color. Then, I can use find/change to apply the correct paragraph style to each cell based on it’s number. I can even set up multi-find-change to do all of this at once.
However – here’s why I would rather use a script – if we resize the table, the paragraph shading size will have to be changed in style 1 (others will auto update). Each table that is a different size will need a unique set of paragraph styles. There are over 20 heat maps, and while many will be the same size, it would be more accurate to know that the cell is really filled with the color, and that I’m not off by a tiny bit.
If only we could apply cell styles with find/change! That would do it.
Is anyone interested in creating a script for this? (i.e. find #1 in the text, apply color #1 to fill the cell (or apply cell style #1). I’m willing to pay, if it’s not too much.
October 28, 2016 at 5:49 am #89390Marie DohertyMember
This link might be useful
October 28, 2016 at 5:53 am #89391
Marie – thanks! Looks like exactly what I need.
I’ll try it out and report back.
October 28, 2016 at 6:53 am #89392Kai RübsamenMember
I posted today in the adobe forum a script, that I wrote a while ago (at the end of the post). There are two other scripts, with similiar tasks as well in this thread.
Maybe a benefit from my version: It can work with 20 styles at once and will check, if you want to style all tables in your document or only the selected ones.
If you should need a special version of the script, this should not be time consuming.
October 28, 2016 at 7:44 am #89393
Kai – thanks for this script!
I especially like that it uses GREP searches rather than Text, and can have multiple searches ganged up.
I will be using it in a few weeks, and once I’m done, I’ll report back on how well it worked.
- You must be logged in to reply to this topic.