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!
