I just noticed that the code i gave would not work on inner tables i.e. tables within a table cell and so forth. But that can be added to it, you just need to check each cell to check for tables within it and then the process repeats itself to iterate each cell. A recursive algorithm fits the bill in this case.

I just noticed that the code i gave would not work on inner tables i.e. tables within a table cell and so forth. But that can be added to it, you just need to check each cell to check for tables within it and then the process repeats itself to iterate each cell. A recursive algorithm fits the bill in this case.

-Manan

Hi Manan,

check the allPageItems array of a cell. That would include also nested tables with their cells and inserted page items.

Something like the code below would work.

Warning! It's not perfect!

It would also remove graphic frames where graphic frames with images are pasted inside!

To find empty graphic frames of any embedded depth, keep testing its parent's constructor until it's Cell or Document. If it's Document the page item is not in a cell. Pasted graphics aren't deleted, by the way.

Because of JavaScript's short-circuit evaluation, you can speed up the script (any script) by rearranging the three coordinated tests. (Short-circuit evaluation means that if the first test fails, following tests aren't done.) If very few page items are in cells, then it makes sense first to test whether any page item is in a cell: if a frame is not in a cell, the two other tests are done. And if very few frames are empty, then first test whether any frame has a graphic.