[reportlab-users] drawing inside a table

Robin Becker robin at reportlab.com
Fri Feb 25 04:46:09 EST 2011


On 24/02/2011 18:22, Brian O'Reilly wrote:

> I have a simple 3" x .75" bar graph that I want to insert into a table. I

> created the appropriate cell in the table to be 3" wide, but the drawing

> overlaps into adjacent cells... what is the trick to getting the drawing

> centered in the cell?

>

> Kind Regards..

>

> Brian

......

well the table flowable draws flowables using a specific api. That is the
Flowable.drawOn api. The table/cell also has style attributes to decide where
the flowable should be drawn. So valign is used to decide whether the cell
should draw from top down bottom up and alignment is used to determine left
right center for the x position.

If the cell contains a single flowable then it's best to assume the standard
behaviour. That means alignment 'LEFT' and valign 'BOTTOM'. Then flowables know
that they should draw from the left bottom of their area.
--
Robin Becker


More information about the reportlab-users mailing list