Putting Graphics Inside Table Cells

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!

Related Articles
Comments

18 Comments on “Putting Graphics Inside Table Cells

  1. 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. 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.

    • Clip an image in a cell

      If an image is too large for a cell, it extends beyond the cell borders. You can clip the parts of the image that extend beyond the cell borders.
      1.Place the insertion point in the cell you want to clip, or select the cell or cells you want to affect.
      2.Choose Table > Cell Options > Text.
      3.Select Clip Contents To Cell, and then click OK.
      THEN follow steps in book regarding creating an anchored graphics frame (page 268?).

  4. 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. 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. 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?

  8. 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

  9. I have been researching InDesign and Table creation recently for a project and unfortunately find the graphic integration into table cells to be difficult to work with in comparison to Quark’s.

    This seems to be something Adobe should work on with newer versions. It seems to be a hassle to work around to get the image to fit exactly into your table.

    My question is: What if you are creating a calendar and 3 or 4 cells do not have days of the week in that row and you would like to import an image in those 3 cells of the row. Is this possible? I have not been able to achieve this either even after merging the cells and making image smaller I still get the override red flag or image not fitting exactly. It almost seems easier to just create a new box to match the merged cell size and place image into that.

    I am working with CS3 version of InDesign.

    Thanks for any input.

    Jasmine

  10. @jasmine: When I merge 3 cells in IDcs4 and place an anchored graphic frame in the resulting single cell (as in the post above) it seems to work fine. I’m pretty sure that should work in CS3, too. Read through the post again to see if you missed any steps.

  11. Thanks for that! I have another question, is it possible to select a number of images in the table. Not all of them but some. I did the usual Ctrl-click but it doesn’t work.

  12. Hi Trish,

    I don’t think you can, once you place an image inside a table it becomes anchored. Meaning it behaves just like text.

    Just as you can’t select text across two cells, you can’t select images either.

    If you want you can perform a scale on an image to the size you want it. Then you can press Ctrl (cmd on mac) Alt and 3 (Object>Transform Again) to scale other images to the same percentage. It would be done in snap.

    The Transform Again can be very useful when rotating, scaling, rotating, flipping objects, you can even perform an action for each, then choose Object>Transform Sequence Again for each image or even Object>Transform Sequence Again Individually for a group of selected images.

    Anne-Marie made a detailed post about the Transform Again feature a while back (sorry i can’t find the post to link to).

  13. The problem I’m having is after I draw a table I would like to place an animation or graphic in the table. They get stuck on the left side. I can’t seem to put them where I want them. Thanks for any help.

  14. @Bonnie: I’m not sure what you’re asking that the blog post above doesn’t already answer. Graphics are inline (anchored) objects inside table cells, so yes, it is a pain to place them properly.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>