Skip to Content

Putting Graphics Inside Table Cells

February 14th, 2008
Written by David Blatner

Bonnie asked:

Can you insert a photo inside a table that will be centered within the cell on InDesign?

You know, if there’s one question I hate, it’s… well, I guess it’s pretty much any question about putting graphics inside table cells. It’s not that there’s anything wrong with the question — it’s a good question! It’s that the answer will invariably include the phrase, “You’re not going to like this.”

I like giving answers that make people smile, that make people’s lives easier. And the answer to anything involving graphics inside cells doesn’t do that. It makes people get itchy and want to change the subject.

Putting graphics inside cells should be easy, but it’s not. That’s because table cells are like little text frames, so any pictures you put in them have to be added as inline or anchored objects. To quote Real World InDesign:

“You place a graphic in a table cell in exactly the same fashion as you insert a graphic in text: click the Type tool in a cell, or select some text inside a cell, then place a file or paste a graphic you copied to the Clipboard earlier. Note that you must select text or have an active text insertion point; selecting the cell itself will not get the graphic into the cell. If you want the graphic to fill the entire cell, make sure the Cell Insets values are set to zero.”

That last piece — setting the Cell Insets to zero — is very important. If you don’t do that, you’ll always have some space around the cell.

If the anchored graphic frame is too large for the cell, you can crop it down along its right edge by opening Table > Cell Options > Text and turning on the Clip Contents to Cell checkbox. You cannot, however, crop the height of the graphic. Why? Because the row height cannot be made smaller than the graphic frame. (Well, it can, but you’ll get text overset). This is, in a word, frustrating.

You asked about centering the image in the frame. Well, there are two ways to do this.

If the anchored graphic frame is smaller than the cell, you could click inside the cell (next to the image frame) and choose Center horizontal alignment from the Control panel (Command-Shift-C/Ctrl-Shift-C). Then open the Cell Options dialog box and set the Vertical Justification to Align Center.

If the anchored frame is larger than the cell, you’ll need to change its dimensions until it’s the same size as the cell itself. (If the cell is 7p6 wide, but has a 1-pt stroke around it, then the graphic frame should be 7p6 wide.) Then, with the graphic frame selected, choose Object > Fitting > Center Content.

If only Adobe would change the table feature so that a single cell could act as either a text frame or a graphic frame (as in QX). That would make things so much easier!

9 Responses to “Putting Graphics Inside Table Cells”

  1. Bonnie said:

    Thank you! Actually, it wasn’t so bad. I just put a giant letter “P” (for photo) inside the box, sized the photo I wanted and copied it, then selected the “P” and clicked “Paste” and it was in, centered and lovely, just as I formatted the giant “P”. Thank you!


  2. You’re overlooking the use of zero-leading paragraphs.

    Put the graphic in a zero-leading paragraph and pull it down by its height or until it reaches the bottom of the cell. Then you can crop the top too.

    You can also type text over the top of the image. This came up a couple of years ago. I remember banging out a script for Cari Jansen when she raised it.

    Dave

  3. Bonnie said:

    I must be, because I don’t know how to do what you’re talking about, lol. I’m still in training- up through chapter 15 of InDesign. Would you please explain a little more or tell me where the chapter is that explains this? Thank you.

  4. David Blatner said:

    I don’t see how you can crop the top of the image. I do see that dragging setting the paragraph to a leading of zero and then dragging the image down (with the selection tool) lets you crop off the bottom of the image. Interesting!

    I also noticed that you can crop the left side of the image by setting the paragraph inside the cell to center or right aligned. When it’s left-aligned (which it normally is), the right side gets cropped; when right-aligned, the left edge gets cropped.

    But again, these are all such painful workarounds.


  5. Ah. The way to crop at the top is to set the cell to clip contents and change the first baseline offset of the cell to one of the fixed values. If it is set to the default Ascent, then it won’t crop at the top and the cell will overset if the graphic is too large.

    Dave

  6. Andrew Herzog said:

    How about this for cropping the top of the image in a cell in a table?

    Select the image using the Selection tool and set the container (blue borders) to the proper size.

    Select the image, contents (red borders) using the Direct Selection Tool. You can move the image in the container without moving/sizing the container, it crops out whatever is not in the container, and you can scale the image without sizing the container.


  7. But that’s cropping an image within its frame. The challenge is to get a too-large frame into a cell in the first place.

    Dave

  8. Andrew Herzog said:

    So would you want the too-large frame to be re-sized per the cell? Should the cell be re-sized per the to-large frame? Or maybe the too-large frame should be pannable in the cell the same way an image is pannable in its container?

    And

    Not too scientific but according to my tests a table cell of:
    4p x 3p will show a 31p x28p image
    3p x 3p will show a 25p x28p image
    2p x 3p will show a 16p x28p image
    1p x 3p will show a 7p x28p image.

    I’m sure we could be more scientific and figure some algorithm for cell size vs image size to fit but why?


  9. I don’t understand where you’re going with this. I’ve explained how to fit a frame of any size into a cell by setting the first baseline offset of the cell to a fixed value. Once you have it in there, you can do whatever you want with it.

    Dave

Subscribe to the Discussion

Get the ongoing discussion surrounding "Putting Graphics Inside Table Cells" delivered to you. Click here to subscribe via RSS/ATOM.

Leave a Reply

InDesignSecrets reserves the right to edit and/or remove posts and comments.

You can use limited HTML tags, such as <em> for emphasis To type a less-than (left angle bracket) symbol, type "& lt ;" (but without the quotes or spaces between the characters).

Name

Mail (never published)

Website