Tables: Fit Content to Frame

(InDesign CS2)
Since "fit frame to content" is available when you select a frame that contains a table, but "fit content to frame" is not...I'm assuming it's not possible to do that.
I understand that a table can lie well within or outside of its frame, and that can be a nice thing. However, what if I want to make sure the boundaries of the actual table, left to right, take up an EXACT width? Seems like making the frame the exact width I need and then having "fit content to frame" available is what I need.
Am I missing something? Does anyone have a good workaround?

Lisa,
This script will do the job (although the interface is a bit primitive. Just type a number in the units you're using for the horizontal ruler. It displays the "before width" and you can then type the number you want instead. It distributes the extra or the deficit across the existing columns of the table.
//DESCRIPTION: Set Width of Table
// by Dave Saunders
if ((app.documents.length == 0) || (app.selection.length == 0)) { beep() }
aDoc = app.activeDocument;
aSel = app.selection[0];
aTable = findTable(aSel);
tWidth = prompt("Table width", String(aTable.width));
if ((tWidth == null) || (tWidth == "")) { exit() }
n = aTable.columnCount;
w = aTable.width;
for (j = n-1; j >= 0; j--) {
  aTable.columns[j].width = aTable.columns[j].width * (tWidth)/w;
function findTable(obj) {
  if (obj.constructor.name == "Table") { return obj }
  while (obj.constructor.name != "Table") {
    obj = obj.parent;
    if (obj.constructor.name == "Application") {
      errorExit("Can't locate table");
  return obj;
function errorExit(message) {
  if (arguments.length > 0) {
    if (app.version != 3) { beep() } // CS2 includes beep() function.
    alert(message);
  exit(); // CS exits with a beep; CS2 exits silently.
To use the script, copy and paste to ExtendScript Toolkit and save with an appropriate name in the form YourName.jsx in the Scripts folder of the Presets folder of your InDesign CS2 folder (you could put it in a subfolder if you wish). Then to run the script, set-up the appropriate initial conditions (click with the text tool in the table) and double-click the script's name in the Scripts palette.
Dave

Similar Messages

  • Fitting Content to Frame to a Path or Mask

    We have been asked by a customer to try and achieve the following:
    They have a number of eps's of a flat screen TV's. For each TV, there is a path around the outside. We will call this Path 1. There is a second path around the screen of the TV. We will call this Path 2.
    Is there a way of placing another image, and fitting content to frame (just like in Indesign), using Path 2 as the bounding box?
    We are using both CS3 and CS4.

    Mark, while Scripts may not be necessary they can add a level of convenience unattainable with Actions.
    As concerns the PAID HELP, the Photoshop Scripting Forum has a couple regulars who, while they may offer their services professionally, still give their advice freely; but in case Adam has no Scripting-experience his needs, should he choose to try a Scripting-solution, might exceed »advice«.
    Having only recently started to appreciate and utilize the capabilities of JavaScript for Photoshop myself I may appear overzealous in advocating it, but everybody will have to decide for themselves if they want to give it a try.
    With possibly hundreds of images I wouldnt want to rely on the screens (or their paths) to all have the same diameter and a Script can allow for that with transforming the placed image according to the height or width so as to always fill the area completely (thus clipping at the top/bottom or left/right depending on the relation).
    And (though too complicated for myself) it would be possible to let Photoshop work off folders and not get stuck by the occasional file that doesnt conform to the naming conventions or lacks a path by ignoring it and documenting unedited files at the end.
    Thats always assuming that the photographs of the tv-sets are fairly frontal, because if they are in perspective then the matter gets much more complicated, but what with the allusion to doing it in Indesign I concluded perspectival transformation isnt required anyway.

  • Shouldn't object style with 'fit content to frame' work with updated images?

    I have a script that places pdf files from a list onto pages. The rectangles are built with an object style that fits content to frame.  This works,  but if the pdf file is then modified, InDesign does not fit the new content to the frame when the link is updated. Is there a reason why the object style does not honor its settings?
    Thanks.

    I have a script that places pdf files from a list onto pages. The rectangles are built with an object style that fits content to frame.  This works,  but if the pdf file is then modified, InDesign does not fit the new content to the frame when the link is updated. Is there a reason why the object style does not honor its settings?
    Thanks.

  • CS4 fit content to frame default

    Hi all,
    Just a quicky, we have just upgraded to CS4 at work (late adopters I know!) and we have an issue with how ID CS4 fits the frame to content by default.  The problem with this is it is changing templates of material built in earlier versions of ID, for instance changing ellipse frames to squares, resizing all the frames to fit the content, etc. Is it possible to change this default behavior? All help is appreciated.
    Thanks

    Hi Guys,
    Thanks for the responses and I apologise for the delay in replying, it has been flat out here... Anyway I just want to confirm that the problem still exists. I am unsure how to explain it further although I will try
    When the frame fitting option is set to 'fit content to frame' Indesign applies a 'fit frame to content' which the operator must then undo. This especially occurs when placing content into ellipse or polygon frames. Indesign always applies a "fit the frame to content" (which obviously blows away the shape), the operator must then undo the 'fit frame to content' that CS4 automatically applies (crtl+z).
    Not sure it is related but we also suffer from a one minute delay upon opening Indesign and Acrobat, the windows "csrss.exe" process goes nuts and sits on nearly 100% cpu usage for about a minute before the program becomes usable. It seems related to the number of fonts installed on the system (around 2000) because if I remove all the fonts, delete the adobefnt files and reinstall the fonts the machine runs fine for a week or so before it bogs down again. I know that this file is not a virus, as we run symantec on our machines, also there is only one copy of this process in taskmanager. Also this has happened across multiple machines with varying hardware. Is there a hard limit on fonts?
    Thanks again
    Regards Chris

  • Suddenly cannot fit content to frame with cmd/shift/E in Mac

    I suddenly, when working on newspaper pages from a set of master templates, can no longer fit an image to a frame using the command/shift/E shortcut to fit content to frame. I can fit the image to frame using the pulldown menu, but not with the shortcut. All I get is an error tone. Also, when I click on the image window with the direct selection tool, instead of the image window being selected, you see this frame outside the image window, like the frame it's working with actually is larger or something (I hope I explained that right). Anybody know what's going on here, and how I might can fix it? I'm sure I accidentally changed some setting somewhere.

    It would help if you gave details about your version of ID and OS.
    The shorcut problem might be due to a switch to a new shorctut set. Any other shortcuts not working? Is the correct set selected when you go to Edit > Keyboard Shorctuts...? Anything else acting strangely? That could indicate a corrupt set of preferences.
    When you select an image with the direct select tool you should see the bounding box of the image which might be larger than the frame containing it (is the image cropped?) selecting a frame withthe direct select tool would reveal a text wrap path, if wrap is applied to the frame. Does either of those sound like what's happening?

  • Can't see the fit content to frame option....

    Hi All,
    I'm having some issues trying to click on:
    Object > Fitting > Fit Content to Frame
    This area is simply greyed out and I cant' select the option to do so.
    Does anyone have any ideas?
    Thanks
    Daniel

    I just wondered if you can please advise how I could click a button and have the text within the text box automatically resize to fit the frame?
    This is not a built-in capability of InDesign.  Macinbytes told you that this was the case, and John told you why.
    However, InDesign has a scripting interface, so plenty of people have written additional tools to make particular tasks easier. I think that one of these scripts from In-Tools will be exactly what you're looking for.

  • Table of Contents text frame, keep intro text

    I have a table of contents textframe on the first page. In that same textframe, I have some intro text. When I click update TOC, it updates the TOC and replaces the intro text with the TOC. How do I keep the intro text?

    I did a workaround (not sure if this is a good solution) where I created another textframe on top of the TOC textframe and put the intro text there.
    However, sometimes, the intro text can be longer and can be overlapped and overset with the TOC textframe. How do I detect if the intro text is overset and if so to "resize it" vertically (at the same time reduce the TOC textframe size vertically)?

  • Fit Content To Frame Crashes InDesign CS3 !

    Hi
    iam try to fit the content to it's frame
    if(Utils<Facade::IFrameContentFacade>()->CanFitContentToFrame(UIDList(newPageItemRef)))
    ErrorCode err=Utils<Facade::IFrameContentFacade>()->FitContentToFrame((UIDList(newPageItemRef)));
    But whenever I execute this methos InDesign CS3 crashes..
    Wht could be the reason??
    thanks,
    nataraj

    You probably need to pass the content item and not the frame.
    Use IHierarchy to navigate to the first child item of
    newPageItemRef and pass that to FitContentToFrame instead.

  • Multiple place and fit content

    I have several chapters of a book done in CS2. These were sent out and edited by a third-party in CS4 (communication issue there).
    So they were backsaved as an .INX file and now I'm using CS3.
    Problem is that the embedded images and links to 20 or so illustrations were not honoured and defaulted to "foo. jpeg" in the links pallette when I opened these in CS3.
    The embedded images (excel graphs) I'm not worried about, it's the linked images which I now have to go in and manually relink.
    The graphic frame and content boundary is intact so re-linking seems to work fine, but I'm wondering If i can select the art and multiple place each image within it's corresponding frame and have the attribute  "fit content proportionately" assigned at the same time.
    Do I use an object style?? I'm not too familiar with this, so if anyone can run me through the simple steps, it would be appreciated.
    Also, I noticed in CS3 that the number of icons for fitting content are reduced on the toolbar (see image circled) compared with CS2?
    Are the options to "fit content to frame, center content etc" only available from the drop-down menu or from the short-cuts?
    Thanks in advance,
    Julian

    Peter,
    Yip, those would be the icons I was looking for, but maybe they weren't visible depending on what i had selected, since I swear I looked for them..but there they are in my screenshot
    I was thinking a basic object style with just fram-fitting option selected to "fit content prop.", but I guess you are right in that the time saved would probably be negligible.
    Any idea as to why the links broke - just a consequence of back-saving??
    Julian

  • Fit Content Proportionally Broken in CS6?

    I have been having a lot of issue with Fit Content Proportionally since upgrading to CS6.
    In many of my documents (some new, some pulled in from earlier versions and saved over as CS6), I find that both via the menu and via the keyboard shortcut, the commonly-used and absolutely essential "Fit Content Proportionally" command just simply does not work.
    I can create a bunch of square frames, and then fill them all with various-sized and shaped images, and then when I would usually Fit Content Proportionally to make them all scale down inside the boxes, what I get instead is no response at all. The only way to "fix" the problem is to go to the toolbar with the content selected and change either the vertical or horizontal percentage to any number at all. As long as the proportion lock is in place, then that changes both % numbers to the same number, and thus fixing the problem. This is what makes me think it is a bug.
    Is there some new fitting setting in CS6 that I need to change?
    I have tried saving as IDML and importing back into CS6, but the behavior persists. Interestingly, if I change the fitting via the toolbar % "fix" and then select Fit Content to Frame (not proportionally), then Fit Content Proportionally is broken again, and does nothing at all.
    On most of my documents, Fit Content Proportionally works exactly as expected, and exactly as it always has. Of course my biggest "problem" documents contain large numbers of images.
    High Res Image:
    http://i.imgur.com/kl9jS.jpg

    This is a bug or a big enough change in behavior that it should come with a warning alert the first time you use it. I've replicated it across different 8.0.1 installs and (Mac) OSs.
    To replicate:
    Place graphic. I haven't seen a difference among placed graphic types.
    Resize the graphic frame non-proportionally.
    Object=>Fitting=>Fit Content to Frame, so that the content is scaled non-proportionally. (Or select the content and scale it non-proportionally.)
    Object=>Fitting=>Fit Content Proportionally. Nothing happens. (Or, if you scaled the content without fitting it in the previous step, the content may be centered, and it may be scaled, but the proportions won't be changed.)
    I suppose you could make an argument that this is more correct than the old behavior—the command now means "Fit without changing the proportions"—but it's a big change, and I doubt anybody wants it to work this way.
    Here's a short script that should more or less give the old behavior:
    function fit(item) {
      var i, l, graphic;
      if (item instanceof Group) {
        for (i = 0, l = item.pageItems.length; i < l; i++) {
          fit(item.pageItems[i].getElements()[0]);
      else if (item.hasOwnProperty("imageTypeName")) {
        item.horizontalScale = item.horizontalScale < 0 ? -100 : 100;
        item.verticalScale = item.verticalScale < 0 ? -100 : 100;
        item.fit(FitOptions.PROPORTIONALLY);
      else if (item.hasOwnProperty("graphics")) {
        for (i = 0, l = item.graphics.length; i < l; i++) {
          graphic = item.graphics[i];
          graphic.horizontalScale = graphic.horizontalScale < 0 ? -100 : 100;
          graphic.verticalScale = graphic.verticalScale < 0 ? -100 : 100;
          graphic.fit(FitOptions.PROPORTIONALLY);
    function main() {
      var i, l;
      if (!app.documents.length) {
        return;
      for (i = 0, l = app.selection.length; i < l; i++) {
        fit(app.selection[i]);
    app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Really Fit Content Proportionally");
    There are  certainly some corner cases I've left out. Let me know if you try to use it and it doesn't work right.
    Jeff

  • Scaling content and frame simultaneously

    I think the best way to explain our problem is by explaining what we want to do.
    We've recently upgraded to CS3 from CS1. In CS1, we would place advertisements in our magazines. The ads might sometimes have a white frame around them (no chance of eliminating them, so not a viable solution). Since the ads didn't always come in perfectly proportioned to their placements, we had to sometimes resize the ads manually, so what we did is we placed the ad image in the file, drew in the frames around the ad (to eliminate the collateral white border) and then use the manual sizing on the top toolbar to resize the ad (at times disproportionately) to its placement. But the content would also resize inside the frame.
    This, however cannot be done in CS3, as far as I can see. We follow all of these steps, up to the last step where we manually enter the new size, except when we do that, the content in the frame does not change at all. The frame instead just cuts into the content.
    Fitting content to frame doesn't work either, because of that white border that's part of the content to begin with. Does anyone know what option we may set to make this back to how it operated in CS1?

    I'm worried about your statement "drew in the frames around the ad." Did you draw something new? The ad should come in with a frame, and if you draw a new frame, it may not be associated in any way with the ad. I do this all the time in CS3 and CS4, and both the frame and content resize together when I click on the scale buttons in the toolbar.
    1. Place the item on the page.
    2. With the solid arrow tool, click on the object and move in the edges of its frame to where you want them, getting rid of white space.
    3. Move the object so that two sides are where you want them (for instance, the top and left line up with the columns or guides).
    4. With the tool-bar's "reference point" chosen appropriately (the top left of the object in this example), use the scale items in the toolbar to scale the object up or down. Both the frame and the content should be affected. Or, alternately, click on the lower right corner of the object, and while holding shift and command, move the bottom corner to scale. (Holding command means that the content is resized along with the frame, shift means that the horizontal and vertical scaling will be identical.)

  • Fit content to a two columns frame

    Hi Experts,
    I need to fit content in to frame (it is a double column). But I can't see any feature in scripting. Manually also I can see fit option only for single column frame. Please advice me.
    thanks,
    Pasu

    Well, that's a bit clearer. How about this -- building on Kasyan's script. The debugging alerts at the start show what properties to check. It fails
    i spectacularly
    if you try this on non-standard frames, f.e., if you put a text wrapping image over part of the first column :-)
    myTextframe = app.selection[0];
    numlines = myTextframe.lines.count();
    alert ("Total: "+numlines);
    numlines_1 = myTextframe.textColumns[0].lines.count();
    alert ("1st column: "+numlines_1);
    if (myTextframe.textColumns[0].lines.count() < myTextframe.textColumns[1].lines.count())
    while (myTextframe.textColumns[0].lines.count() < myTextframe.textColumns[1].lines.count())
    var myBounds = myTextframe.geometricBounds;
    myBounds[2] += 1;
    myTextframe.geometricBounds = myBounds;
    } else
    while (myTextframe.textColumns[0].lines.count() > myTextframe.textColumns[1].lines.count())
    var myBounds = myTextframe.geometricBounds;
    myBounds[2] -= 1;
    myTextframe.geometricBounds = myBounds;
    if (myTextframe.overflows)
    myBounds[2] += 1;
    myTextframe.geometricBounds = myBounds;
    break;

  • Table of Contents into existing text fame?

    Hi there,
    I'm looking to put a table of contents about halfway down a page that has content on it (paragraph > ToC > another paragraph). I don't want the ToC in its own text frame, because if the copy/layout before it changes, it'll be in the wrong place...
    Is there a way to do this without copying/pasting the ToC into the text frame (which doesn't permit me to update the ToC)?
    Thanks in advance!
    - steve

    flossdaily wrote:
    Hi there,
    I'm looking to put a table of contents about halfway down a page that has content on it (paragraph > ToC > another paragraph). I don't want the ToC in its own text frame, because if the copy/layout before it changes, it'll be in the wrong place...
    Is there a way to do this without copying/pasting the ToC into the text frame (which doesn't permit me to update the ToC)?
    Thanks in advance!
    - steve
    The TOC needs to be in a frame that's not threaded to others, but is able to grow and shrink to contain its content, and also resize in relation to frames around it.
    Typefi systems' InDesign CS4 free Auto-fit plug-in probably can do what you want, but there's no sign of a CS5 version at this time.
    http://www.typefi.com/index.php/typefi-autofit
    The commercial Blatner Tools has an autopage component probably can also do what you want.
    www.dtptools.com/help.asp?id=108
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • Spacing in table of contents

    Is there a way to adjust, to increase, the minimum amount of spacing between a table of contents entry and it's page number for single line paragraphs? I know that I can insert non-breaking spaces in long paragraphs, but if a paragraph fits on one line, that doesn't help.
    The screen grab below shows an entry on the first line that is too close to the page number. The second line is the way I want it to look, but I have to do a forced return to set it up. Of couse, when I re-generate the table of contents the forced return disappears, so I'm hoping that there is another technique.
    If editing the frame.ini file would control the spacing, how woiuld that be implemented?
    Is there a script to control the spacing?
    I'm cross-posting this in the FrameMaker unstructured forum as well.

    Jay,
    The method I use is not obvious but works because of the way FrameMaker seems to work.
    For EACH paragraph format used in your TOC, the ones ending in TOC, open the paragraph designer. One of the tabs (cannot remember which one) has a place to specify spacing adjustments. There are three boxes: minimum, optimum, and maximum. Typically, the minimum is set to 75%, the optimum to 100%, and the maximum to 125%. Add 100, or 200, or 300% to the minimum AND the maximum, BUT NOT the optimum, which remains at 100%. For example, the minimum could be 175%, the optimum 100%, and the maximum 225%. Click Update All. I would do this in the template file, and then import the paragraph formats into all the files in your book. Then update the book.
    I THINK FrameMaker tries to adjust the spacing using the minimum and maximum, determines where to break the line, and then sets the spacing to the optimum 100%. The result is a line break a short space before the end of the line. You can experiment. The more you add to minimum and maximum, the longer the space between the line break and the end of the line.
    Van

  • How would I set up this table of Contents?

    I want a TOC that looks like this:
    Chapter title.......................................author's name......................................page number
    Is this possible? I have always done it manually.
    Thanks
    Ian

    I can give you something that will be a little less manual, although not completely automated. It might seem like a lot of work, but it only takes a bit of time in the setup, and after that, it's all copying and pasting. Have a look at this screenshot:
    I put in some placeholder text, created a headline style, and another style (the 6pt magenta text) called For TOC. I put in the title and author placeholders, separated by a tab and set the width of the text frame to something just below the width of the text frame that holds the body text, and I collapsed the height to fit the text. I set the placeholder text frame to non-printing with Window>Output>Attributes, copied the frame, and pasted it just after the headline paragraph (with a space between the headline and the now-anchored placeholder frame).
    I then set the inline object to a custom position so that no matter where the headline was on the page, the anchored frame would be at the top of the page away from the spine. And, because the inline frame is set to non-printing, it won't show up on printouts or when exported to PDF. Once that's all set up, just copy the anchor and the space (you can use the story editor to make sure you are selecting just those two things) and paste them next to any headlines (or titles, in your case). You then copy the titles from the main text and paste them over the Title in the placeholder (I used Edit>Paste Without Formatting so that the style of the headline would change to the style of the placeholder). You would also type in the name of the author when you are entering the title into the placeholder.
    In the table of contents, you would select the For TOC style, instead of the headline style for inclusion into the TOC. Make a paragraph style for the actual TOC, and set the tab stops there, and you will have:
    Title..............Author................Page #
    The placeholder will travel with the title, so as long as you remember to update any text in the placeholder if you choose to update the titles, you should be good to go.

Maybe you are looking for