Fit frame to content in rectangles in table cell

I use this script:
app.activeDocument.rectangles.everyItem().fit(FitOptions.frameToContent);
It works, but not if the rectangle are inside a table cell. What can I do?

You need to do cells separately. Take a deep breatch, then:
app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().rectangles.eve ryItem().fit(FitOptions.frameToContent);
Peter

Similar Messages

  • How to fit frame to content when content contains anchored text box?

    Hi there
    I am creating a series of inline text frames within a text frame. Each of these inline frames contains text which includes an anchored text frame. If I tell my inline frames to fit to content they seem to ignore the anchored frames contained therein. Is there any way I can get them to consider the anchored frames they contain when they fit to content?
    I tried checking the geometric bounds of my anchored frame before and after its parent frame has fitted to content. Even when there has been no change in position the bounds after fitting to content seem to give numbers way off. I thought I might be able to reset the geometric bounds of the containing frame manually if the anchored frame therein had moved with the fit frame to content.
    Here is a snippet of my code:
    var anchoredBounds = anchoredFrame.geometricBounds;
    mainFrame.fit(FitOptions.FRAME_TO_CONTENT);
    mainFrame.texts.item(0).recompose;
    var newAnchoredBounds = anchoredFrame.geometricBounds;
    alert(anchoredBounds[0] + "; " + newAnchoredBounds[0]);
    So “mainFrame” is the text frame containing text and the anchored frame, “anchoredFrame”. “anchoredBounds[0]” seems to correlate with the top edge of the frame when I check it manually after the script has finished (when it hasn’t move with the fit to content). “newAnchorBounds[0]”, however, always gives numbers that are way off every time. Any ideas why this would be the case?
    And most importantly, can anyone suggest how I can get my “mainFrame” to consider the “anchoredFrame” contained in it when it fits to content?
    I’m using CS4 on a PC. Let me know if it would help to post more code, or if I haven’t explained myself clearly enough.

    Is there any way I can get them to consider the anchored frames they contain when they fit to content?
    @Graham – as long as ALL the anchored text frames are "inline" text frames,
    mainFrame.fit(FitOptions.FRAME_TO_CONTENT);
    should work as expected or at least sort of *.
    Without calculating anything at all.
    Just tested in InDesign CS5.5 (v7.5.3).
    Could it be that CS4 will fail on that?
    Of course, you can only rely on this, if the main text frame contains any "real" text at all. Not only the  special characters representations of the "inline" text frames. In that case the fit() method will do nothing at all.
    * it's debatable, if the fit() method yields desirable output.
    It depends on your expectations.
    See the following examples:
    1. Case 1:
    Text frame before fitting:
    2. Case 1:
    After fitting with the UI command, context menu: "fit frame to contents"
    (note the gap between the last baseline of the text and the text frame; note also  the new width)
    Is that the result you would expect? I guess not.
    3. Case 1:
    After fitting  programmatically with myTextframe.fit(FitOptions.FRAME_TO_CONTENT);
    4. Case 2:
    Before fitting
    same text frame as in #1, but different height
    5. Case 2:
    After fitting with the UI command, context menu: "fit frame to contents"
    A different width than in #2 and a gap at the bottom of the text frame!
    Not the desired result, I'd say…
    6. Case 2:
    After fitting  programmatically with myTextframe.fit(FitOptions.FRAME_TO_CONTENT);
    Same result as in #3
    So with scripting we could, at least, get consistent results.
    Of course, you could get the same results in the UI, if you double-click on the bottom center control point…
    Maybe it helps, if you are showing us some screen grabs:
    1. Your starting point
    2. The desired result
    Uwe

  • Fit Frame to Content Bug in InDesign CC? Keyboard shortcut not working

    Using InDesign CC 9.1 in Mountain Lion, recently installed and has been working fine except I noticed that the keyboard shortcut for Fit Frame to Content won't work, even though the other frame fitting shortcuts work. I searched this forum and elsewhere to see if there was any reported bug for this but came up with bubkis.
    When using the contextual menu option or toolbar button for Fit Frame to Content I don't have any problem. I thought perhaps my own set of shortcuts had overridden this default shortcut somehow so I reverted to the default set without any luck. I quit and re-opened ID with the default shortcut set, no luck either.
    In the Keyboard Shortcuts menu options, when I try to assign Opt-Cmd-C it does say it's already assigned to that function. I'm at a loss here to understand why this one particular function isn't working as a shortcut. Any ideas why? What can I do? Thanks.

    It's working for me in InDesign CC on the same operating system.
    Here's a couple ideas:
    Make sure there's not a Mac OS X system shortcut already set to this shortcut. Go to System Preferences > Keyboard Shortcuts and check all the tabs for existing system shortcuts (I didn't find any but maybe you had set one). InDesign CC now gives preference to the system.
    You could also try restoring your InDesign preferences.

  • Box containing text and image (fit frame to contents).

    Hi all,
    The best way I can describe what I am trying to achieve is to show you a picture.
    So essentially, I'm looking to create a grey box, containing some text with an image floating to the right hand side. I want about 2mm space (padding) inside the grey box so no content goes right to the edge and I want the text to wrap around the image. The bit I'm finding tricky is when I go to use the 'Fit frame to content' option. I'm trying to remove the space indicated by the red arrows but if I anchor the image inside the text frame, the grey box shrinks to the height of the text and the image overflows.
    This would be incredibly simple to achieve on the web, am I doing something wrong?
    Any help/direction would be greatly appreciated.

    Sorry, been out for an hour.
    I understood that you want to have some variable height text frame (the gray box), and that this box should reduce in height to fit the text contained therein, but not  less than necessary for the bottom to be 2mm below the bottom edge of the variable height image (which I'm presuming is anchored to the first line of text in the frame) in a case where there is not sufficient text for fit frame to content to avoide making the frame shorter than the bottom of the image.
    I believe this could be scripted, but that will still require you to run the script. You should ask over in InDesign Scripting
    As far as a container that holds both text and image frames, yes, but only if you "paste into" a new frame after creating the two separately and grouping, which probably is not what you have in mind.

  • Script to select all overflow text frames and fit them to content?

    I have a document with several text frames that have overset text, due to replacing a font.  I was looking for a script that would:
    1. find all the text frames that have overset text
    2. apply "fit frame to content" command for each of these
    Can anyone please help me here?  I'm trying to learn scripting but some of these things still confuse me.  Thanks.

    hi,
    give a try to this js code:
    var _d = app.documents[0];
    var _allStories = _d.stories;
    for(var n=_allStories.length-1;n>=0;n--){
    var _storyAllTextFrames = _allStories[n].textContainers;
    for(var m=_storyAllTextFrames.length-1;m>=0;m--){
    _storyAllTextFrames[m].select();
                //Fit Frame to Content:
                try{
                app.scriptMenuActions.itemByID(11291).invoke();
                    }catch(e){};
               try{
               app.scriptMenuActions.itemByID(278).invoke();
                    }catch(e){};
    Disclaimer:
    I'm NOT a scripter. Sorry, don't remember exact origin of this code, but it works...

  • Table cell formatting : please allow 'Horizontal autosizing' with 'at least' option like the vertical. Or is it in the pipeline already ?

    I suspect it has been asked by others, but can't find it in the archives. I need it for table cells with diagonals, and they need to fit like a glove.

    Hi,
    if the content is in a table cell (<td>), simply use valign="top" in the Region HTML table cell attributes.
    "Vertical align" is not intended to align text in a block, but an in-line component in another in-line component (for example a picture next to text).
    Maybe you have to play with margins.
    PS : more information here for example : http://evolt.org/article/rdf/17/60369/
    Yann.

  • Autofit column width to table cell content in Pages

    Hello,
    Would anyone know how to autofit the column width of a table cell in Pages '09?
    I have searched Pages Help to no avail.
    Thank you very much in advance.

    There is a checkbox in the table inspector to auto-resize to fit content. Unfortunately, that only seems to work with rows, not columns.

  • ID cs6:How to Fit Frame to Version heart(or Page) with script?

    More times, I need my Frame fit to my Version,or fit to my page,
    I looking for the scrip in the Internet, only see "frames  to content"
    Who would like to help me?
    Thank you very much~

    Hi  Kai Rübsamen
    Thank  you very much.
    Some times I must press Ctrl+Z, It will  be ok?
    and ,I want to select more than one text frame.
    and, the script is wrong in some document ,Tested, I find  should be make the Coordinate origin to the The upper left corner
    Could you like to add this Function into the scrip.
    thanks
    fit to margins
    var curDoc = app.activeDocument;
    if ( app.selection.length != 1 ) {
        ( alert ( "Something wrong with your selection!" ) );
        exit();
    var curSel = app.selection[0];
    var curPage = curSel.parentPage;
    var rO = curDoc.viewPreferences.rulerOrigin;
    if (rO != 1380143215) {
        curDoc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
    var pW = curDoc.documentPreferences.pageWidth;
    var y1, x1, y2, x2;
    if ( curPage.side == PageSideOptions.leftHand ){
        x2 = curPage.marginPreferences.left;
        x1 = curPage.marginPreferences.right;
    else {
        x1 = curPage.marginPreferences.left;
        x2 = curPage.marginPreferences.right;
    x2 = pW - x2;
    var gB = curSel.geometricBounds;
    // fit to margins
    gB[1] = x1;
    gB[3] = x2;
    curSel.geometricBounds = gB;
    curSel.fit ( FitOptions.FRAME_TO_CONTENT );
    resetAsBefore();
    function resetAsBefore() {
        if ( rO != 1380143215 ) {
                curDoc.viewPreferences.rulerOrigin = rO;
    fit to page
    var curDoc = app.activeDocument;
    if ( app.selection.length != 1 ) {
        ( alert ( "Something wrong with your selection!" ) );
        exit();
    var curSel = app.selection[0];
    var curPage = curSel.parentPage;
    var rO = curDoc.viewPreferences.rulerOrigin;
    if (rO != 1380143215) {
        curDoc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
    var pW = curDoc.documentPreferences.pageWidth;
    var y1, x1, y2, x2;
    if ( curPage.side == PageSideOptions.leftHand ){
        x2 = curPage.marginPreferences.left;
        x1 = curPage.marginPreferences.right;
    else {
        x1 = curPage.marginPreferences.left;
        x2 = curPage.marginPreferences.right;
    x2 = pW - x2;
    var gB = curSel.geometricBounds;
    // fit to page
    gB[1] = 0;
    gB[3] = pW;
    curSel.geometricBounds = gB;
    curSel.fit ( FitOptions.FRAME_TO_CONTENT );
    resetAsBefore();
    function resetAsBefore() {
        if ( rO != 1380143215 ) {
                curDoc.viewPreferences.rulerOrigin = rO;
    best wishes

  • SCALING FRAMES AND CONTENT

    I am using ID CS4. I'm having a little trouble figuring out how the scaling features work. It seems I can only manage to scale the frame and not the content. I have discovered the object/fitting/fit content to frame feature but it seems such a long work around. Can you not enter numeric values in the height or width boxes and it scale both frame and content any more? Any help would be greatly appreciated.

    It's not very intuitive but if you put the actual numeric values into
    the percent fields it will work. Just make sure to put the full
    value...6in, not 6.
    Bob

  • Restrict user to see the contents of a transparent table

    Hi fnds,
    i want to restrict users in seeing the contents of a database table..
    ithat is, when they go to se16 and hit enter.. and try to execute F8 button.. it should not show any records and no access should be available to that user...
    Can this be possible with auth object - whoever is authorizeed they only shoud see the contents..
    how to do this.. this table doenst not have table maintanence -- no SM30 data maintancne..
    help me,
    thanks
    Niraja

    This is part of the table definition in the data dictionary (not sure with what release that was introduced, but if you're not on an old system you should probably have it). I.e. in the data dictionary (SE11) on the Delivery and Maintenance tab for the table you have a field Data Browser/Table View Main., which you should set to N Display/Maintenance not allowed. If you check the F1 help on the field you'll get a nice long explanation.
    If you don't have this option (on an old release) check out OSS note [26909 - SE16 - Security|https://service.sap.com/sap/support/notes/26909], which explains your other option via authorization object S_TABU_DIS (access control might be a bit too coarse). See also OSS note [546797 - FAQ Data Browser (SE16)|https://service.sap.com/sap/support/notes/546797].
    Cheers, harald

  • Space in table cell content

    Hi,
    I want to add some space before and after the table cell content. I am using setIntercellSpacing() method to achieve that and I could get the required functionality. But its adding space in the Table Header also which looks odd. Is there any way to set the spacing only for the cell and not for the table header.
    Let me know if anyone has solution for this.
    Thanks and Regards,
    R.Vishnu Varadhan.

    I find this behaviour of setIntercellSpacing() very annoying, too. Why the hell did the Swing developers implement it that way?
    Nevertheless, you can create the desired effect by writing a custom cell renderer, but that is if course more work than that single method call.

  • The contents in a internal table

    Hi Experts,
    I have a doubt in filling the contents of an internal table with the database table fields reference.
    For eg: There is an internal table like this:
    data: begin of t_conditions occurs 0,
                 kschl like rv13a-kschl,
                 vkorg like komg-vkorg,
                 kunnr like komg-kunnr,
                 matnr like komg-matnr,
                 kbetr(15) type c,
                 datab(10) type c,
                 datbi(10) type c,
          end of t_conditions.
    in the above example, the "matnr" he has taken with the reference field "komg-matnr"..
    Please look at the following internal table:
    data: begin of t_material occurs 0,
                    matnr(18) type c,
                    matkl(9)  type c,
                    bismt(18) type c,
          end of t_material.
    In the above 2 examples the declaration of "matnr" field is diffrent from one with the other.
    in 1st eg., he has taken as: <b>matnr like komg-matnr</b>
    where as in the 2nd eg: <b>matnr(18) type c,</b>
    my question is: how can i know where to declare as in the 1st eg., and where to use like in the 2nd eg.,
    Please clarify.
    I greatly appreciate your help.
    Thanks,

    Hi sey
    If you see in the domain level both the DOMIAN's will be the same. So it doesn't matter. All the matnr will have a character type of size 18.
    for the programmer reference they will using the table name in which they want to select the data.
    i.e for the first ex. he will be selecting data from the KOMG table and in the second from the MARA table.
    but both the Matnr type are same.
    <b>there is a small change since the second ex doesn't use any table it is simply of type c. the difference is when you reference to any Data DICTIONARY object then it can contain certain conversion exits, etc. so it will apply for your reference data typr</b>
    regards
    kishore
    Message was edited by: Harikishore Sreenivasulu

  • How to pass the contents of an internal table to the IDoc FIDCC2?

    Hi,
    I have an internal table. Using its contents, I have to create an Idoc and do GL posting.
    I have to use FIDCC2 Idoc and the function module IDOC_INPUT_FIDCC2.
    Can u please let me know how to pass the contents of the internal table into the idoc FIDCC2 and do the GL posting?
    Regards,
    Balaji. R

    Hi balaji,
    use function IDOC_INBOUND_FROM_FILE. This will do half the process.
    Documentation is missing, but program RSEINB00 explains something,
    also some links
    [http://help.sap.com/saphelp_nw70/helpdata/EN/dc/6b7f1543d711d1893e0000e8323c4f/frameset.htm]
    [RSEINB00 does not work in background]
    [RSEINB00 flat file to idoc uploading in XI]
    [Loading flat idoc via report RSEINB00 into integration server fails]
    Hope it helps.
    Regards,
    Clemens

  • Customizing the Cell Content of a Pivot Table

    Hi,
    I have been away from ADF for a few years (since 10g v 1.3.1) and am quite impressed with all the Faces functionality added to the 11g release. The application I wrote relied heavily on pivot tables which back then, I had to use stored procedures in the database and dynamically views to display information. I am very interested in moving this application to 11g and taking advantage of the PivotTable component. One thing the application does is change the style of cells based upon the object being presented. I have been reading:
    Oracle® Fusion Middleware
    Web User Interface Developer's Guide for Oracle Application
    Development Framework
    11g Release 1 (11.1.1)
    B31973-03
    And am very interested in section 26.8 Customizing the Cell Content of a Pivot Table.
    I easily created a pivot table and would like to change the formatting of various cells. I created a backing bean for a test page and added the Example 26–4 Sample Code to Change Style and Text Style in a Pivot Table to the bean.
    public CellFormat getDataFormat(DataCellContext cxt)
    CellFormat cellFormat = new CellFormat(null, null, null);
    QDR qdr = cxt.getQDR();
    //Obtain a reference to the product category column.
    Object productCateg = qdr.getDimMember("ProductCategory");
    //Obtain a reference to the product column.
    Object product = qdr.getDimMember("ProductId");
    if (productCateg != null && productCateg.toString().equals("Sales Total"))
    cellFormat.setTextStyle("font-weight:bold")
    cellFormat.setStyle("background-color:#C0C0C0");
    else if (product != null && product.toString().equals("Sales Total")
    cellFormat.setTextStyle("font-weight:bold");
    cellFormat.setStyle("background-color:#C0C0C0");
    return cellFormat;
    Almost verbatim except changed the literals to select data in my use case domain. My question is: How do I invoke this message from my pivot table? I need to pass it a instance of the DataCellContext. The example is great and illustrates what I am looking to do but does not go into the implementation details required. Is there a sample app available for download that demonstrates these capabilities?
    Thanks,
    Jeff
    Edited by: jcapzz on Jun 9, 2011 3:56 PM

    Hello,
    I haven't fully understood your question.
    Is it: How do I call the getDataFormat() method from my pivot table?
    If so , you need to set the dataFormat attribute of your pivot table.
    ex: <dvt:pivotTable id="pt2" var="cellData" varStatus="cellStatus"
    value="#{bindings.YourView.pivotTableModel}"
    headerFormat="#{viewScope.yourBean.getHeaderFormat}"
    *dataFormat="#{viewScope.yourBean.getDataFormat}"*
    contentDelivery="immediate" pivotEnabled="false"
    columnFetchSize="-1" rowFetchSize="-1"
    />
    I also put the *headerFormat* attribute which allows to customize the headers
    I hope I understood your question ;)
    Jack

  • Need content in table cell to scroll

    I Need content in table cell to scroll, so the window stays a constant height. Help.

    Google for 'scrollable DIV' or 'iframe'. Scrollable DIVs are better.

Maybe you are looking for

  • Is It Possible To Select And Copy Text From A PDF Document ?

    Occasionally I would like to copy and paste text from .pdf documents. I have not found any way of doing it - is it impossible ? If it can be done - how ? Ian.

  • I can't update my ipod nano

    though i can download the songs but i'm unable to update the newly downloaded songs. what should i do? can anyone help me? thanks a lot! ipod nano   Windows XP  

  • Java.Security.keytool

    hi, i am working on the digital signature, I found some java book have this line: signature.initSign(keystore.getPrivateKey(alias, a)); but there is no such a getPrivateKey method when I compile, do anyone can tell me why? If this method has really d

  • Problem with BIS & OWA

    Hi, I have a problem with the setting up of an OWA account on BIS website.  I think my only fix may be to change my email address formatting but I do not want to nor should I have to as this has been our email setup for years.  It would be appreciate

  • Modified jsff files are not recompiled

    Hi all, We have several jspx ADF pages that include a region which displays a taskflow. The default view of the taskflow is a jsff file. When we change the jspx file itself, weblogic picks up the modified file time and recompiles it, showing the upda