How do I accurately detect overset contents when using tables?

Hello, all. I am familiar with how to detect overset contents of a text frame, namely:
if ( myTextFrame.parentStory.contents.length > myTextFrame.contents.length) {
  alert('There is overset text');
} else {
  alert('There is no overset text');
However, the contents of my story are three tables, rather than text. Each table contains dozens of cells filled with text. Yet the "length" property of the frame is only 3! How do I accurately read the length of the content given that most of it is in tables so that I can test for overset text?
In case it helps anyone, a more detailed description is:
If there are three tables in the story, and only 2 fit on a page-sized text frame, the length property of that frame will be 2. Kind of weird, but not a problem yet.
In the same scenario, however, if the third table BEGINS on the page but spills over (creating an overset situation), the length property of that frame will be 3 -- causing the test think there is NO overset text! InDesign simply sees 3 characters in the story, and only 3 characters on that page.
When I look at the "contents" property of the story, it just reads 3 squarish characters. They're obviously some kind of special character. InDesign apparently takes the concept of "table" and just writes a placeholder character for it in the "contents" property.
Am I going to have to create some routine to loop through every cell of every table and somehow add it all up to get a proper length? How do I just test for overset-ness?
Thank you!

Actually, Harbs, I'd already just burst my own bubble by running additional tests! So I have to revise my whole set of instructions.
IGNORE EVERYTHING I WROTE ABOVE.
Here is the revised solution, based on the initial solution proposed by Dirk and then revised to work around Harbs bug discoveries. It is essentially a corrected version of Dirks line. Instead of saying:
app.activeDocument.stories.item(0).tables.lastItem().cells.lastItem().insertionPoints.last Item().parentTextFrames.length
you would say:
app.activeDocument.stories.item(0).tables.lastItem().cells.lastItem().parent.parent.insert ionPoints.lastItem().parentTextFrames.length
That's just the short version. Here's the full code and explanation:
Summary of problem:
InDesign treats a table as a single special character, so it does not accurately report the "overflows" property of a text frame containing a table which spills beyond its margins. A text frame will show as not overflowing (i.e. myTextFrame.overflows will return false) if its final table simply begins within its margins--even if most of the table spills well beyond the text frame. So a ten-page table that starts on page one will only considered by InDesign scripting as being one character long (and therefore shown as fitting completely in first frame even when it doesn't). The solution for this, as discovered by Dirk, is to test whether the final cell of the table is in an overflow area.
The solution:
You cannot just test whether the cell is overflowing, or whether the parent text frame is overflowing, because InDesign will misreport them and their contents when they are in an overflow area, making it impossible to distinguish a cell overflow from a containing-text-frame overflow. So we just check the parent text frame of the final insertion point, which is after the last table, and see if its length is zero (meaning has no visible contents). If so, the insertion point is in an overflow area!
So the test to run is this:
var finalCell = myTextFrame.parentStory.tables.lastItem().cells.lastItem();
if(finalCell.parent.parent.insertionPoints.lastItem().parentTextFrames.length==0) {  ...your code here...  }
Of course you'll replace myTextFrame with the one you're dealing with in your own script.
Example usage:
This is how I implemented this in my own script. I have an array of text frames which I pass to this function, and by the time I call the function this array contains only one element, just the first large text frame (with my long table already placed inside it). It also relies on a helper function drawTableFrame which is simple and I'll leave out; it just adds a text frame to the new page and sizes it. And of course myDocument I've long ago set to be the document I'm working in.
// Takes array of text frames, checks for overflow, and adds pages as needed
function addOverflowPages(whichFrameArray) {
    var i = 0;
    var finalCell = whichFrameArray[0].parentStory.tables.lastItem().cells.lastItem();
    while (finalCell.parent.parent.insertionPoints.lastItem().parentTextFrames.length==0) {
        i++;
        var newpage = myDocument.pages.add(); // add new page
        whichFrameArray.push(drawTableFrame(newpage)); // draw new frame
        whichFrameArray[i].previousTextFrame = whichFrameArray[i-1]; // link new frame to previous one
I hope this one is solid at last. I have tested it with empty final cell, full final cell, partially-overflowing final cell, and totally-overflowing final cell, and they all work for me. Thanks again to everyone for pointing me in the right direction!

Similar Messages

  • How to set fetchsize of sql Query when using Database Adapter.

    Hi All,
    I am using DatabaseAdapter to connect to database and retriving huge amount of data.For improvement in the performance I want to set the "fetchsize" of sql query. I know fetchsize can be preset in Java using Jdbc 2.0 API.Please let me know how to set this value in BPEL when using DBAdapter?
    Thanks
    Chandra

    I talked to the developer of the db adapter - and he told me this feature will be available in BPEL PM 10.1.3 (which is supposed to be production later this year, and a public beta soon). If this is an emergency I would recommend going throug Oracle support and have them file an enhancement for 10.1.2.0.2
    hth clemens

  • How to transfer range parameter from vb when using bapi calling

    Hi,everyone.how to transfer range parameter from vb when using BAPI calling?

    Did you get the solution to your problem?  Can you please share it with me. I have a similar problem. I have a VB program that calls RFC function. It works with a single parameter but not with a range of parameters. If you have the solution, could you please share sample codes with me? Thank you so much.

  • How can I show additional tab rows when using many open tabs?

    How can I show additional tab rows when using many open tabs?

    What method (code) did you use to get the Tab bar displaying in the space used for the Navigation Toolbar (location bar)?
    The Tab bar should be displayed above the Navigation Toolbar.
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • How do images embeded in InDesign link when using Creative Cloud on more than two desktops?

    How do images embeded in InDesign link when using Creative Cloud on more than two desktops?

    If I am understanding your question correctly, you shouldn't have to worry about embedded images in InDesign. Once embedded, the image is stored within the file.
    If you are wondering about linked images... InDesign will follow the path on your computer and, if it does not find the image, you will recieve a notification. Edit: To prevent this, I would suggest packaging your file using File > Package... This will create a folder with all of your fonts and linked graphics so that you need not worry about broken links.  I just remembered that you cannot upload folders directly to Creative Cloud so a packaged folder wouldn't be very helpful unless you wanted to upload each file manually.
    The best solution I see right now is to either embed the graphics in the document, or upload the images with your document to relink.
    I hope this helped,
    Michael

  • Msi x99 gaming 9 ack does not detect capture card when using with xsplit

    msi x99 gaming 9 ack does not detect capture card when using with xsplit
    i install every but still it does not work.

    Hi
    It wasn&#39;t hard to find your motherboard version:
    http://www.msi.com/support/mb/Z68AGD80_B3.html#down-bios
    Since your BIOS is v20.1, it couldn&#39;t be G3 
    Apart from checking BIOS, you can only check motherboard or moth...

  • How do you update the Bios safely when using onboard RAID mirror? Z87-G45

    How do you update the Bios safely when using onboard RAID with Z87-G45?   I'm using a simple two drive, RAID 1 mirror setup.
    I'm currently at bios 1.4, and want to move up.  However, last time I upgraded the BIOS, the machine rebooted with improper settings for the RAID (they get hosed during BIOS flash) and Windows decided to auto-repair the only boot drive it could see, one half of the mirror, because it couldn't see the RAID array correctly and *POOF*  bare-metal reinstall required.   
    My PC will not let me press the DEL key on bootup to access the bios, even with MSI Fast Boot not installed.  It just ignores the DEL key and tries to load windows which, if that happens, will flame-out my RAID array after a bios flash if I can't catch it to enable the RAID first before windows loads.
    I do not want to rebuild my PC again simply because I do a BIOS update.

    FYI: BIOS 1.4 & 1.8 are using the same RAID version: 12.7.0.1936
    based on this RAID surprise should not hapends.
    But as pandaz says if you have no issues, leave bios update alone.
    there are still risks something to messed up,
    best do a backup of your data just in case if you want to try latest version

  • Help: Jbo Exception non blocking when using table cell renderer?

    Hi,
    JClient 9.5.2.
    When using Table Cell Renderer on an table cell attribute that is defined mandatory and activating the insert button, the (oracle.jbo.AttrValException) JBO-27014 exception is caught but it is not blocking and a new row is still inserted.
    The JClient component demo, table attribute list, has the same behaviour.
    You can add multiple rows even if not all required attributes have been documented.
    Can a Swing specialist help me on this one?
    Example of Table Cell Renderer:
    public class TableBasicStatusRenderer extends DefaultTableCellRenderer
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
    int row, int column)
    JLabel lb = new JLabel((String) StaticData.getStatusName(value)); // retrieves label from Map
    return lb;
    Regards
    Frederic

    Hi,
    I found something interesting, it could be a WORKAROUND!
    I noticed that in another detail panel with table layout the JBO exception was blocking and adding another row before completing the row was NOT possible.
    In the create method of the entity object of the displayed View Object I iterate over the detail row iterator to retrieve a maximum value.
    By the end of the method the pointer is positionned after the last row.
    So I added to the detail panel that doesn't block following code:
    In create method of detail Entity Object Impl (only one entity object involved for this View)
    // Retrieve master EntityObjectImpl from association:
    PostalTariffImpl postalTariffImpl = getPostalTariffAssoc();
    // Retrieve detail default row iterator
    RowIterator ri = postalTariffImpl.getPostalDetailGroupAssoc();
    // Position pointer after last row
    ri.last();
    ri.next();
    Question: Why does this solve the problem?
    Regards
    Frederic
    PS Les mysteres de l'informatique!

  • Detecting transform errors when using org.xml.sax.XMLFilter

    I am using javax.xml.transform.sax.SAXTransformerFactory.newXMLFilter to transform xml against a pipeline of stylesheets (See function testPipelineTransform in the example below). The process works okay, excepting that I cannot figure out how to detect errors in the transformation process.
    I would like to achieve the same result for the pipeline process as I would for a single transformation using javax.xml.transform.Transformer.setErrorListener. The example below demonstrates how the call to javax.xml.transform.Transformer.setErrorListener does not generate the same result when using org.xml.sax.XMLFilter as it does when using a single transformation.
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.SAXException;
    import org.xml.sax.InputSource;
    import org.xml.sax.XMLReader;
    import org.xml.sax.XMLFilter;
    import javax.xml.transform.ErrorListener;
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.sax.SAXTransformerFactory;
    import javax.xml.transform.sax.SAXSource;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    import java.io.*;
    public class FilterChain {
        static private final String newline = System.getProperty("line.separator");
         public static void main(String argv[]) {
              System.out.println("Testing pipeline transform");
              testPipelineTransform();
              System.out.println("Testing single transform");
              testXsltSingleTransform();
         } // main
         static private void testPipelineTransform() {
              try {
                   // Set up the input stream
                   BufferedInputStream bis = new BufferedInputStream(
                             new ByteArrayInputStream(getExample().getBytes()));
                   InputSource input = new InputSource(bis);
                   // Set up to read the input file
                   SAXParserFactory spf = SAXParserFactory.newInstance();
                   SAXParser parser = spf.newSAXParser();
                   XMLReader reader = parser.getXMLReader();
                   // Create the filters
                   SAXTransformerFactory stf = (SAXTransformerFactory) TransformerFactory
                             .newInstance();
                   XMLFilter filter1 = stf.newXMLFilter(new StreamSource(new StringReader(getStylesheet1())));
                   XMLFilter filter2 = stf.newXMLFilter(new StreamSource(new StringReader(getStylesheet2())));
                   // Wire the output of the reader to filter1
                   // and the output of filter1 to filter2
                   filter1.setParent(reader);
                   filter2.setParent(filter1);
                   // Set up the output stream
                   StreamResult result = new StreamResult(System.out);
                   // Set up the transformer to process the SAX events generated
                   // by the last filter in the chain
                   Transformer transformer = stf.newTransformer();
                   transformer.setErrorListener(new ErrorListener() {
                        public void error(TransformerException te)
                                  throws TransformerException {
                             System.out.println("Transform generated Transform Error");
                             System.out.println(te.getMessage());
                        public void fatalError(TransformerException te)
                                  throws TransformerException {
                             System.out
                                       .println("Transform generated Transform Fatal Error");
                             System.out.println(te.getMessage());
                        public void warning(TransformerException te)
                                  throws TransformerException {
                             System.out.println("Transform generated Transform Warning");
                             System.out.println(te.getMessage());
                   SAXSource transformSource = new SAXSource(filter2, input);
                   transformer.transform(transformSource, result);
              } catch (TransformerConfigurationException tce) {
                   // Error generated by the parser
                   System.out.println("\n** Transformer Factory error");
                   System.out.println("   " + tce.getMessage());
                   // Use the contained exception, if any
                   Throwable x = tce;
                   if (tce.getException() != null)
                        x = tce.getException();
                   x.printStackTrace();
              } catch (TransformerException te) {
                   // Error generated by the parser
                   System.out.println("\n** Transformation error");
                   System.out.println("   " + te.getMessage());
                   // Use the contained exception, if any
                   Throwable x = te;
                   if (te.getException() != null)
                        x = te.getException();
                   x.printStackTrace();
              } catch (SAXException sxe) {
                   // Error generated by this application
                   // (or a parser-initialization error)
                   Exception x = sxe;
                   if (sxe.getException() != null)
                        x = sxe.getException();
                   x.printStackTrace();
              } catch (ParserConfigurationException pce) {
                   // Parser with specified options can't be built
                   pce.printStackTrace();
         static private void testXsltSingleTransform() {
              try {
                   BufferedInputStream bis = new BufferedInputStream(
                             new ByteArrayInputStream(getExample().getBytes()));
                   // Set up the output stream
                   StreamResult result = new StreamResult(System.out);
                   InputSource input = new InputSource(bis);
                   TransformerFactory factory = TransformerFactory.newInstance();
                   Source source = new StreamSource(new StringReader(getStylesheet2()));
                   Transformer stylesheet = factory.newTransformer(source);
                   stylesheet.setErrorListener(new ErrorListener() {
                        public void error(TransformerException te)
                                  throws TransformerException {
                             System.out.println("Transform generated Transform Error");
                             System.out.println(te.getMessage());
                        public void fatalError(TransformerException te)
                                  throws TransformerException {
                             System.out
                                       .println("Transform generated Transform Fatal Error");
                             System.out.println(te.getMessage());
                        public void warning(TransformerException te)
                                  throws TransformerException {
                             System.out.println("Transform generated Transform Warning");
                             System.out.println(te.getMessage());
                   SAXSource transformSource = new SAXSource(input);
                   stylesheet.transform(transformSource, result);
              } catch (Exception exc) {
                   exc.printStackTrace();
         private static String getStylesheet1() {
              return
                     "<?xml version='1.0' encoding='ISO-8859-1'?>" + newline
                   + "<xsl:stylesheet" + newline
                   + "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'" + newline
                   + "version='1.0'>" + newline
                   + "<xsl:output method='xml'/>" + newline
                   + "<xsl:template match='/'>" + newline
                   + "<DontCareAboutContent></DontCareAboutContent>" + newline
                   + "</xsl:template>" + newline
                   + "</xsl:stylesheet>" + newline;
         private static String getStylesheet2() {
              return
                     "<?xml version='1.0' encoding='ISO-8859-1'?>" + newline
                   + "<xsl:stylesheet" + newline
                   + "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'" + newline
                   + "version='1.0'>" + newline
                   + "<xsl:output method='html'/>" + newline
                   + "<xsl:template match='/'>" + newline
                  + "<html><body>" + newline
                 + "<xsl:message>" + newline
                 + "Error Message for the xslt processor" + newline
                 + "</xsl:message>" + newline
                 + "Dont care about the xslt content," + newline
                 + "The only significant part is the xsl:message element" + newline
                 + "which results in a error to be handled by the xslt" + newline
                 + "processor" + newline
                   + "</body></html>" + newline
                   + "</xsl:template>" + newline
                   + "</xsl:stylesheet>" + newline;
         private static String getExample() {
              return
                     "<?xml version='1.0' encoding='ISO-8859-1'?>" + newline
                   + "<DontCareAboutContent>" + newline
                   + "</DontCareAboutContent>" + newline;
    }

    I made the following change which solves the problem but the sollution is tightly coupled to Xalan. If anyone has any ideas, I would still like to find a way to achieve the desired result using JAXP API's.
                   XMLFilter filter1 = stf.newXMLFilter(new StreamSource(new StringReader(getStylesheet1())));
                   if (filter1 instanceof org.apache.xalan.transformer.TrAXFilter) {
                        ((org.apache.xalan.transformer.TrAXFilter)filter1).getTransformer().setErrorListener(...);
    ...

  • Detect Client Disconnect When using RTMP

    Hello,
    I hava a Java Server and Clients using RTMP. I've read somewhere that I can detect instantly client disconnection when using RTMP. However I cannot find an example code (in Java) that demonstrates this functionality? Can you help me please?

    I am not sure how your client looks, however the lient connect using NetConnection under the hood which spits NetStatusEvents's and you can listen to them ...
    C

  • How can I increase the thumbnail size when using Safari to upload an image to a website?

    I upload many images to multiple websites and when using Safari to upload these images, the thumbnails are so small I can barely make out what the image is. I can easily figure out how to increase the thumbnail size when viewing them in Finder and set the default to my liking, but I cannot seem to find a way to do this in Safari. The last topic I saw on this was form 2013 and have not seen any update. Is there a way to do this?

    Delete all unused, invisible layers.
    Sometimes zip compression is better than jpg compression (in the pdf output settings). Zip is lossless, and works better with non gradient colour or no images.
    Flattening the image before you save it to pdf can reduce the file size if you are using jpg compression.
    Post a preview of your pdf and we can comment further on how to reduce the file size.

  • How do you turn off Flash audio when using captivate Nav bar?

    Hi Guys and Girls
    I have an imported flash file that plays an audio track,
    I have no problem turning the audio off, when the user uses
    the button within the flash file to go to the next slide in the
    captivate movie...
    on(release){
    stopAllSounds();
    _root.rdcmndNextSlide = 1;
    BUT if the user decides to use the navigation bar within the
    captivate movie it all goes pair shape.. The flash audio continues
    to play into the next slide. Anyone have a know how to solve this
    problem?
    How do you tell flash to stop playing the audio when using
    the captivate navigation bar?
    (The flash file is a flip book and the audio NEEDS to stay
    within the flash file)
    Cheers
    Aquil0

    Thank you! Thank you! Thank you! This totally solved my issue. I had a Captivate 4 movie using an embeded animation that had audio. It would play the audio again when the next slide appeared. I have to use Captivate 4, because my audience still uses Flash 7 (yikes). However, if you have Captivate 5 and are having this problem there is a widget that solves this issue: http://blogs.adobe.com/captivate/2010/11/animations-%E2%80%93-audio-sync-issue.html#commen t-3872
    Thanks!
    EliteEraser

  • How to do "java Program 50 7" when using Eclipse?

    If you use the command-line environment to compile and run a java program called Sample.java instead of using Eclipse, you could compile by writing "java Sample 30 5" or replace the 30 and 5 with other numbers (lets suppose the Sample.java needs 2 int inputs). How would you do the equivalent of that when using Eclipse?
    Thanks!

    In the Run , there is an arguments tab ..

  • How to totally turn off data traffic when using ma...

    Nokia N8-00:
    I only use the integrated gps and have turned off the assisted gps, net based gps and Wi-Fi/Network but when accessing maps it still generates data traffic.
    Normally this is´nt a problem but when traveling abroad data traffic costs a small fortune.
    In my old N95 when I downloaded offline maps and turned everything but integrated gps off there was no data traffic at all but even after the latest maps updates (i.e. yesterday) it appears that the maps still needs downloading when accessed...
    Any suggestions how to completely avoid data traffic when using maps?

    Set all destinations to always ask and select no whenever the phone gives you a request, set Maps to offline, and set location to just use intergrated GPS. By the way, just been to Portugal using Vodafone and data charges only about £5 for week, and they've just improved allowances, may be worth checking your service providers web site and see if it's necessary to bother about data roaming, they all tend to follow each other, and Data roaming charges in europe seem to be coming down !
    If I have helped at all, a click on the White Star is always appreciated :
    you can also help others by marking 'accept as solution' 

  • How do i get mail notifications -sounds when using hotmail

    Hey everyone,  I know theres a way to do it but haven't figured it out yet.  How do I get a sound notification when I get new mail - currently using hotmail on my ipad.   Thanks

    This is a general setting for all mail.
    Settings > Notifications > Mail
    Configure it the way you want..........

Maybe you are looking for

  • Animated gifs are grainy problem

    I cannot for the life of me figure out how to make my animated gifs look great from flash. I have exported the layered psd files as pngs, jogs, gifs, bitmaps, you name, I have done it, BUT to no avail. Someone please help me, why can't the websites j

  • Error while server instance start up

    We are using SunOne App Server 7.0 on Solaris 9.x. While starting the server instance, we are encountering following problem WARNING: CORE3283: stderr: sm_ftok failed calling stat: No such file or directory WARNING: CORE3283: stderr: 8752: CSemCounte

  • BOM Explosion Dates between Quotes and CIR's

    Hi All I have inconsistencies occurring in the BOM between the Quotation and the CIR when changes occur to the BOM. The quote uses the "pricing date" to explode the BOM while the CIR uses the "delivery date". As a result they are both exploding diffe

  • Online survey on cloud computing

    Hello everyone I am doing a research on cloud computing aiming to identify what benefits have been realized and what possible challenges are introduced using different cloud service models i.e. Software as a Service (SaaS), Platform as a Service (Paa

  • My whole screen froze,no keys are working

    I have open 3 windows and as i tried moving from one to another the screen froze and the track pad was not reponding. There is a constant knocking noise. What to do ?