Copy link to clipboard
Copied
I have a script that is checking some things in table cells, one of which is the baseline of the first line of text.
Is there a way to detect when a cell is empty, but it isn't big enough to show the end-of-text marker? Trying to get the baseline of such a cell causes an error, which makes perfect sense, and I've been unable to find a way to detect that scenario.
Thanks
1 Correct answer
Hi @KenWK
Is there a way to detect when a cell is empty, but it isn't big enough to show the end-of-text marker?
Let myCell be the Cell instance and ips its .insertionPoints property (ips=myCell.insertionPoints). Your condition can be expressed as:
1 == ips.length && 'undefined' == typeof(ips[0].properties.baseline)
Note. – The bad news is that this test transiently involves the ips[0].property object, which is legendaryly inefficient like any other command sent to the Text components of a
...Copy link to clipboard
Copied
Have you looked at cell.overset?
Copy link to clipboard
Copied
JavaScript have try...catch for this.
Copy link to clipboard
Copied
Hi @KenWK
Is there a way to detect when a cell is empty, but it isn't big enough to show the end-of-text marker?
Let myCell be the Cell instance and ips its .insertionPoints property (ips=myCell.insertionPoints). Your condition can be expressed as:
1 == ips.length && 'undefined' == typeof(ips[0].properties.baseline)
Note. – The bad news is that this test transiently involves the ips[0].property object, which is legendaryly inefficient like any other command sent to the Text components of a Table. I think it should still be a bit faster than the try...catch approach suggested by Robert, but it would be worth confirming with a timed test.
Best,
Marc
Copy link to clipboard
Copied
Sorry, brianp311, I meant to mention in my original post that when the cell is empty the overset returns False.
Great suggestion Marc, thanks, may check it out at some point. For the limited scope I need right now it is currently working with a try catch that targets the error that gets thrown (which is something like "not applicable in the current state") but I was hoping to get more specific, which your suggestion does.
While investigating I saw something on an Adobe page that mentioned "uncomposed" text so I thought maybe I was missing some way of detecting when something was "uncomposed."
Thanks everyone!
Copy link to clipboard
Copied
Derp. Would have realized that in a caffeinated state 😉 Glad Marc came through.
Copy link to clipboard
Copied
😆

