Make Scalable Shapes with Data Merge
Data Merge is a feature of InDesign that I use regularly to prepare personalized mail campaigns. (Editor’s note: see Colin’s excellent in-depth article about Data Merge in InDesign Magazine issue 52.) Recently, I discovered a feature that made it possible to scale shapes during a Data Merge! It uses a combination of Data Merge, some “no fill or stroke” type, and the auto-size feature of text boxes introduced in InDesign CS6.
For this to work, a few things are required:
- A csv or txt file that has numbers between 1-1000 in the fields;
- The font “Chartwell Bars” (actually, I’ll talk about how you can do it without this font at the end of this article)
- The shape to be scaled… it has to be a closed vector that can be drawn either in InDesign or cut and pasted from Illustrator to InDesign.
Here is how this trick works:
- From the Data Merge palette, choose “Select Data Source” to begin a data merge. The data field that will be responsible for changing the size of the shape needs to have numbers between 1-1000 within that field.
- Make the appropriate shape in InDesign (or cut and paste a single solid shape from Illustrator into InDesign) and make sure it is a text frame. If necessary, turn the shape into text-frame by clicking inside the shape with the text tool.
- Add the variable data field containing the variable number to the shape, and set the font to Chartwell Bars. Make sure Discretionary Ligatures formatting is turned on, and give the text a fill and stroke of None.
- Then you need to change some text frame options: particularly the auto-size drop down field in the Text Frame Options dialog box. If a shape is to be scaled proportionally, select “height and width (keep proportions)”, and then set a height (or width, it doesn’t really matter) constraint for the minimum size to zero. If the shape is to be distorted, then the appropriate height/width only option is selected, again with a minimum size of the shape of zero. Its origin point is then one of the nine points that can be selected from the auto-size feature. The appearance of the shape can also be influenced by the vertical justification of the text.
The following pictures show what is happening. To understand how this works, I’ve set the font color to black in the images below, and I’ve inserted pink dots to indicate the origin points of the shapes. The word «no» indicates the data merge number field.
The blue triangle scales left to right only, while the circle and star will scale proportionally based on their origin points. Here is what happens when the preview checkbox is toggled on, showing the value of the first record (527):
And now, to the next record (the number 165):
Finally, here is how the shapes look when the Chartwell Bars font is coloured with no fill or stroke:
As you can see, the value in the field changes the size of the object!
There are some conditions with the trick:
- The value of the variable data must a whole number be between 1 and 1000. It cannot be blank, zero, or anything else.
- This slows down the speed of the data merge, even more so when this trick is used more than once on a page.
- The shape has to be a single shape that can become a text placeholder when a text cursor is placed into it. Luckily the shape can be complicated and even contain effects from InDesign’s effects panel.
For users who do not have the Chartwell Bars font, a similar trick can be achieved by replacing the numbers with short or long words. Because the font within the scalable shape has no fill or stroke, the words used won’t be seen, but instead the space the words occupy will shrink or expand the scalable shape. Using the Chartwell Bars font works better for shapes that require precision or a greater range of scalability.