I have recently been working on a program that needs to be able to know the precise location of both shapes and tables.
My document would look something like this:


The thing is, that both the shapes and the tables can be of different lengths. Therefore, I need to know the precise length of each of these elements.
Now i know that it is easy enough to get the height of the shape, but I do seem to have more problems with the table. The table always returns a value of 999999. I have read that it is not possible to get table height so I came up with a couple of possible solutions.

Solution 1:
If I can get the table into a rectangle shape, use auto fit or something and then I can simply calculate the height of the shape.
Solution 2:
If I can add a shape directly after the table I can calculate its height based on the starting and end position.
Solution 3:
I am somehow able to read the height

I think that I can work with all these solutions, but I have no idea how to code this.
Any suggestions or help would be greatly appreciated!