Tables inside overset text frames

Hi everybody!
Im trying to write a script to set the width of all tables in a document equal to its parent text frame, I was succesful, but
the tables that are overflowed do not get resized. I have only come up with a way to find if there is an overflowed text frame
but not to find and overflowed text frame contents. PLS HELP!
heres my code:
//resizes tables
var myTextFrames = app.activeDocument.textFrames.everyItem();
var myTables = myTextFrames.tables.everyItem().getElements();
for (var i = 0; i < myTables.length; i++){
         var myTextFrame =  myTables[i].parent;
                    var myWidth = myTextFrame.visibleBounds[3] - myTextFrame.visibleBounds[1];
            myTables[i].width = myWidth;
//finds a textframe with overset text
var myOverset = app.activeDocument.textFrames.everyItem().getElements();
                for(var x = 0; x < myOverset.length; x++){
                    if(myOverset[x].overflows == true){   
                    alert("There is overset text")

@Kai – cool. Maybe just a little thing:
You suppose that the first text frame of a given story has the same width as the one with the overset (holding a table in the overflow).
So, if we have the following situation:
A table in the overflow will get too wide after running your script:
Instead of the first text frame in the story we could address the last one directly with:
else if ( container.constructor.name == "Story" ) {
    var myTextFrame = container.textContainers[0].endTextFrame;
And the result will be:
The property endTextFrame is in the class of TextFrame.
We could also have written:
else if ( container.constructor.name == "Story" ) {
    var myTextFrame = container.textContainers[container.textContainers.length-1];
Uwe

Similar Messages

  • How to copy a table from one text frame to another...

    Is there a way to copy a table from one text frame to another? I'm using JavaScript. The following will move a table from one text frame to another, but I need to copy.
    var srcFrame = document.textFrames.item("section-template");
    var dstFrame = document.textFrames.item("test");
    srcFrame.characters[0].move(LocationOptions.before, dstFrame.insertionPoints[0]);
    Thanks,
    Mike-

    Hi Bhupinder,
    According to your description, you want to copy a table with Primary keys from one database to another database.
    As per my understanding, I think the best method is use Transfer SQL Server Objects Task in SQL Server Integration Services. The Transfer SQL Server Objects task transfers one or more types of objects in a SQL Server database between instances of SQL Server.
    Server roles, roles, and users from the specified database can be copied, as well as the permissions for the transferred objects. Indexes, Triggers, Full-text indexes, Primary keys, Foreign keys can also be copied.
    To use the Transfer SQL Server Objects Task, we should create a SQL Server Integration Services Project in SQL Server Data Tools, then drag a Transfer SQL Server Objects Task to Control Flow pane. Specify SourceConnection, SourceDatabase, DestinationConnection
    and DestinationDatabase for the Connection, select the table in the ObjectsToCopy category, then change CopyPrimaryKeys to True and the other corresponding properties in the task.
    References:
    Transfer SQL Server Objects Task
    Transfer SQL Server Objects Task in SSIS 2008 R2 With Example
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to give Bold style inside Single Text Frame

    Hi
    I created a text frame with some text in it. It comes in three paragraphs. First para is the title with two words and below two are small description. All the text is kept in single textframe and I need that to be in single frame only. NOW, I need to bold the first para that is the title with two words. How can I write the code to give bold style to the first paragraph inside that frame? Do I need to take different frame? I want all in single actually. Also I want the entire text frame to give my customized text color.
    Hoping a valuable suggestion
    Thanks in advance.
    Regards
    P

    Dave, Good questions(s)!!! Details below...
    It's CS2. I need to put some text in all (many) documents I work regularly. Instead of copying from the previous file or any other source, as the text is same for all, I thought of writing the script with the text itself. Running that will create text frame and write the text. Got almost but was unable to bold the title of the text which I mentioned earlier as a first paragraph with two words.
    Also I couldn't give the my color swatch to the text.
    Here is my script:
    var myTextFrame = app.activeWindow.activePage.textFrames.add()
    var myParagraph = myTextFrame.paragraphs.item(0)
    var myFont = app.fonts.item("Arial")
    myTextFrame.geometricBounds = ["11.2in", "6in","9.57in","0.5in"];
    myTextFrame.contents = "First Paragraph"
    myTextFrame.parentStory.insertionPoints.item(-1).contents = "\r This is Second paragraph.";
    myTextFrame.parentStory.insertionPoints.item(-2).contents = "\r\rHere comes the Third Paragraph with extra para space";
    myParagraph.parentStory.appliedFont = myFont
    myParagraph.parentStory.pointSize = 8
    myParagraph.paragraphs.item(-1).spaceAfter = "0.05in"
    myTextFrame.fit(FitOptions.frameToContent)
    Hope this answers all your questions. Waiting for valuable solution. Have another question will ask after I got this. For now, two questions 1) making bold first two words 2) font color

  • Text alignment inside custom text frame

    I created a custom text frame by combining a triangle and a rectangle using Pathfinder->Add but when I added text, this is how it looked --  but I wanted it to look this way.

    Ketchapay2 wrote:
    Thanks! I'll try that now. UPDATE: When I applied rounded corners, it also rounded the pointer which is supposed to be sharp.
    Well, that used to work, I think.
    In any case, I just tried something else and it seems to work. Make the round corner text frame and the the triangle as you did before. Put the triangle BEHIND the text frame and make the shape. There is however, another potential problem to this technique -- the text will want to flow into the triangle area. I don't think this is escapable without either putting the text into a seond rectangular frame in front, or adding an empty frame in the triangular area and applying text wrap to push the text back into line.
    Peter

  • 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)?

  • Indesign CS 5.5 Table overset text issue?

    In Indesign CS 5.5 , I find strang issue on my File. I created table with single text frame, end of table, notes was there (Out side of table). When I add the below space to table through Table Option, The notes went to overset text. Though I have enlarged the text frame, not worked, Later I clicked the oversert icon and created new textframe placed then the notes appear. when I delete the text frame again text gone to sit in the exact place.
    What is the accual Issue?

    Your setup looks very simple and should not cause issue however I think the issue is Space After value , if this value exceeds so that the text couldn't be accomodated in InDesign then it will be overset.
    Making the new text frame will fix it as there will be enough space.
    What if you reduce the Space after value to "0" , does the text appears below the table or is it still overset ?
    Would like to see the screen shot (with Hidden character enabled) of the pages with and without issue, to understand it better.

  • Table text frame width adjustment by script

    Hi,
    I have to capture my table cells within ‘Text Frame Width’ option with ‘Distribute Column Evenly’ , when it’s going to beyond the ‘Text Frame Width’. Is this possible by script?
    by
    hasvi

    Hi Hasvi,
    Try this.
    var doc = app.activeDocument,
        _tables = doc.stories.everyItem().tables.everyItem().getElements(),
        _tfwidth, _cells, finalwidthofcell;
    for(var i =0;i<_tables.length;i++)
            var currentwidth = 0;
            _tfwidth = _tables[i].parent.geometricBounds[3] - _tables[i].parent.geometricBounds[1];
            _cells = _tables[i].rows[0].cells;
            for(var j=0;j<_cells.length;j++)
                    currentwidth +=_cells[j].width;
            if(currentwidth > _tfwidth)
                    finalwidthofcell = _tfwidth/_cells.length;
                    for(var k=0;k<_cells.length;k++)
                            _cells[k].width =finalwidthofcell;
    Regards,
    Chinna

  • Mouse Click Inside text Frame

    Hi,
    I need to get notification when user click inside a text frame (textStrory). I had gone through the IEventWatcher but I am not getting on which should I place this interface.
    Any Suggestion will be  greatly appreciated.

    Yes
    Search for HitTest.
    Dirk

  • What is the best way to import a graphic? & How do I create a text frame for a figure caption?

    Hello all! I've been working from the FM book for almost 2 hrs trying to figure this out, so now I need your help. I am almost to this point:
    Problem I: Importing a graphic
    First of all, which is the best way?
    -Insert an anchor frame and then import the graphic into the frame OR
    -Just insert the graphic and get the anchor frame by default
    Here’s my importing and sizing problem:
    I hit ENTER to make a new paragraph line (side note: the book says make a new paragraph by hitting ENTER, import the graphic, and then ESC m+p to shrink wrap so that you can avoid the graphic overlapping the above text. I do exactly this (I believe), but my graphic still overlaps the above text when I shrink wrap. What the...?)
    I insert an anchored frame with position Below Current Line and alignment CENTER (I chose to the insert anchor frame, since this way I have control over its alignment, correct?)
    Anchor frame is selected when I import my image file
    In the Imported Graphic Scaling box, what do I select if my file is HUGE (3072x2304)?
    -Fit in selected rectangle (when I choose this the image imports small and fits in the anchored frame with lots of white space around it)
    -72 dpi
    -75 dpi
    -150 dpi
    -300 dpi
    -Custom dpi: 96 (I’ve tried changing this to a smaller number (20) and I get a message that says “cannot handle a bitmap of that size.”)
    I’ve had the best luck with selecting FIT IN SELECTED RECTANGLE, and then I just scale the image with my shift+click. If I choose 72 dpi or Custom, my image imports HUGE, and I just can’t manage it. I don’t have a method for resizing these images outside of FM.
    Problem II: Creating a text frame for a caption
    Once I have chosen FIT IN SELECTED RECTANGLE, I try to insert a text box underneath the image (and inside the anchor frame) to type a caption in it.
    In Create New Text Frame box, the default is Number 1 and Gap 0.25. I click SET.
    Next, I double-click inside the text frame to begin typing, but the cursor is OUTSIDE and UNDERNEATH the text frame! What the heck??? I’ve done this before and it has worked just fine. Then I had another problem where when I did get the text inside the text frame, I would select the text frame to move it, and it left the text behind! (I moved the frame but the text was separated from it and left behind.)
    THANK YOU in advance for your help. I hope I wrote this out clearly enough. I appreciate those who respond. P.S. I'm in FM 10.

    My favorite method is to use a one-cell table for graphics and captions.
    Import the graphic by reference into the table cell. Create a "Caption"
    paragraph tag and assign it to the table title. (The title can be set
    for above or below the table cell. I prefer below.) Now, whenever you
    insert this table, it will be ready for graphic and caption. Another
    advantage of this method is that graphic and caption always stay
    together at page/column breaks.
    When you create the table format above, assign it to have a -2.0 space
    above. Then, create a paragraph tag, such as "TableAnchor" and assign it
    -2.0 pt font size and -2.0 space below. (You can substitute a different
    point size, but it must be the same in all three places. The TableAnchor
    paragraph will hold the table and these settings let tables fit against
    the top margin where necessary. Otherwise, they dip down a bit.
    I wrote this from memory, so I hope I remembered all the steps!

  • Images are pasted as anchored text in a text frame.

    Whenever I paste an image I copied with ctrl+c from another software, its pasted into indesign as an anchored object inside a text frame.
    What should I do to have all images pasted with ctrl+v always be pasted as a graphics frame?
    ps: I have no object styles created or assigned to anything.

    The images that are in-line in Word are likely actually in a table.
    Try these settings in Word--a pita I know in graphic heavy Word docs, but they should then paste into ID in image frames.
    Change from In line with text to In front of text.
    Then switch to the Position Tab and uncheck the indicated checkbox--assuming it is checked...
    The "handles" on the picture will change to look like these below. You should then be able to copy and paste.

  • How to Embed a Text Frame Within a Text Frame with Smart Text Reflow

    This is driving me nuts, and I've wasted hours searching exhaustively but can't seem to find the answer.
    I've been working with this indesign file and cleaning it up really well.  I now have all the text flowing with smart text reflow.  There are two parts in the book that have columns of information, or tables.  The way it was originally done was having a text box placed inside the text box.  But unfortunately, whenever you add pages before or after, the text box won't follow with the text box it is inside.  I have tried grouping the two text boxes together, but this doesn't seem to work with Smart Text Reflow (since every page is based on the primary master). How do you embed a text frame inside another text frame that is based off the primary master?  I guess it would be like using the text frame as an object. 
    I included an image to help my explanation.
    I even tried adding columns and then spannign the header part across, but this still doesn't flow with the rest of the text.

    ANchor it into the other text fram, look in the help file. Keyword = Anchored Objects.

  • Inconsistent placement of anchored text frame in data merge document

    Just writing up this bug so that anyone else who encounters it can find out what's going on with less head-scratching.
    It seems that InDesign's data merge feature gets confused when there are anchored objects in a text frame that's anchored inside another text frame, which can result in:
    exported PDFs that don't match the InDesign preview when viewed in Acrobat (so, nasty surprises on some pages after exporting)
    InDesign previews that - bizarrely - show differently depending on whether you navigated to the preview by hitting the arrow keys in the Data Merge box or by entering a number.
    (sadly I can't provide a file for confidentiality reasons - but the problem point had multi-line data merge entries, a text frame that was anchored in another text frame of equal width, and anchored images and text frames in this anchored text frame)
    There were certain entires where, if I navigate to them in the preview using the 'next' and 'previous' keys, there was 4mm less space between the nested text frame and the previous line than if I navigate to it by entering the number. Exporting as a PDF through data merge used the variant with more space.
    Re-working the area in question so that the nested text frame wasn't needed seems to have removed the problem (but loses the ability to vertically align these elements in a fixed size frame that is in the text flow).

    You didn't say what version of ID, or whter a single or multiple record per page merge, but the Preview is known to be buggy for multiple records since CS5 and might be for single records as well.
    I have an annual directory that is built by data merge with one section in each listing as an anchored frame, and I've never had a problem, but it's not as complex as your description, nor do I ever merge to PDF (though I've heard here from several users that it's more reliable).
    One thing you might want to try is merging without the preview step, but do it from a "fresh" file by copying and pasting your placeholders into a new document. If the problem is with the preview it seems that it "infects" the file and even merging without touching the preview button may not work.

  • How to select a text frame that has been "Sent to Back"?

    Hi Framers,
    In FM 7.2 (all patches up to date, running on Windows XP Pro), I added a note inside a text frame next to an anchored frame holding an image. I nudged the text frame close to the image but it blocked out a tiny portion of the image. So I selected the text frame and from the Graphics menu clicked Send to Back.  Solved that problem, of course. Now I want to change the wording in the note but can't do it because the entire text frame has been sent to back -- how can I select it to Bring to Front so I can edit its contents???
    This MUST be something totally obvious, right?  Can I plead pre-holiday brain freeze?
    TIA,
    Gay

    galson wrote:
    Hello again, Sheila ;~)
    I selected all and moved my cursor all around the page (around various pages, actually, since Ctrl+A selects the entire chapter), and I see what you mean by the color of the arrow's head changing between black and white. Is it significant that the ONLY time it's black is when I'm outside the frame of the page itself? (That is, in the white, non-editable space around the actual frame borders on the page.) Clicking anywhere, whether inside or outside the active area, deselects everything.
    HOLD THE PRESSES!  Even though I *knew* I hadn't grouped my text frame with anything else, after reading your suggestion, I selected the page frame to make sure I hadn't somehow grouped it with my text frame: I hadn't -- but then, on a hunch, I sent IT (the page frame) to the back -- now I can select the text frame!
    I'm marking your response as answering my question and I'm also going to try to mark Peter's the same way, because each of you in your own way, helped me resolve this problem.
    Thank you both and HAPPY HOLIDAYS!  (Gee, and I didn't get either of you anything... maybe next year  ;~))
    Gratefully,
    Gay
    Hi, Gay:
    The "I-Beam" pointer tool is called the Smart Pointer, because it changes to an I-beam when it's over text, and to the Graphics Pointer tool when over a graphic, or part of a graphic, or when you press Ctrl. It's easy to select the main text frame when you Ctrl+click on its interior text area inadvertently, when you're trying to select an anchored frame edge, or when you use Ctrl+A to select all. It's frustrating to have some of these unintended events happen when you're not expecting them. Always work with View > Borders ON, to display the edges of objects and reduce confusion, and always watch where you click. You can zoom iin to large magnification to see things better.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • Printing Overset Text

    I have been a professional user of InDesign for some time now and I mainly work with large documents and have found many timesaving scripts and workflows, but one thing InDesign just doesn't do is deal with overset text.
    Say I have 30 text frames in a document and all of them are overset. I want to print out all the spreads and print out the overset. Is there a way to do this without having to manually link all the overset text frames to another page? This is just so time consuming!
    I am working in CS3 so maybe CS4 addresses this issue. If it does please let me know. But with every new release of Indesign, I get excited hoping they have dealt with this oversight.
    It would be nice if someone created a script that linked all overset text to a new text frame in a new document and then tagged it with the first four words in the original text frame. It would save so much time. Maybe I just need to buckle down and figure out how to do this.
    Thanks for any info
    Jesse

    While I appreciate the advice, the clients I work with would rather have good ol' hard copy proofs.
    I use an InCopy workflow with one of my regular clients and I love it but convincing every client I work with to go out and purchase a $300 program just isn't that practical when I might only do one project a year with them. They want to know why I can't just put the text on another page.

  • Overset text warning

    Quick question about this dialog box. If I get an overset text warning and I check "Don't show again," does that apply only to the current document or to all future documents?
    I know I can reset the dialog box if I disable it, but what I'd like to happen is that I'm warned the first time and then no longer for each document. There are some documents I print where I know there will be overset text, but others where I don't want to miss it.
    If anyone knows for sure which way it rolls I'd appreciate it. Thanks.
    --T.

    Peter and Peter,
    I'm afraid that this script has a bug in it. The length property of an associative array is only non-zero if one or more of the names can be interpreted as a number.
    So, running the script with two overset text frames on page 1, the script works if I have no section marker associated with page 1, but if I put in a section marker [Edit: I meant section prefix] that isn't a number, the script fails to find the overset frames because the length in that case is still zero.
    I stumbled on this while trying to use these arrays to assemble an index from a spreadsheet. My entries were the names of the indexed items and I couldn't work out why (a) my array was showing a length of zero yet (b) Peter's script seemed to work.
    So, the question is, what is the safe way to determine whether or not an associative array is populated when you don't know the names of any of the elements?
    And right now, I'm stumped on that, so I'll throw the question open to anyone who knows.
    Dave

Maybe you are looking for