I am drawing a table on reportlab canvas. While drawing, we need to pass bottom left coords of the table to the drawOn method. The height of my table is dynamic and therefore it overlaps on the elements above the table. I couldnot find any method that returns the height of a table that is to be drawn. Is there an alternate way to do that?
This is such a simple thing that is passively demonstrated but not explicitly addressed in the reportlab documentation:
t = Table(tableData, style=tStyle)
t.canv = myCanvas
w, h = t.wrap(0, 0)
The variables w and h will then store the table's width and height, respectively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With