[reportlab-users] drawing inside a table

Matt Folwell mjf at pearson.co.uk
Fri Feb 25 05:10:12 EST 2011

On 25/02/2011 09:58, Brian O'Reilly wrote:

> On 11-02-24 01:22 PM, 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?


> Okay, it turns out that when the cell is exactly the same width as the

> drawing that contains the bargraph, the layout engine overflows the

> drawing into the column to the right. I made the table cell that

> contains the drawing a little bit wider, and it's neatly centered. Is

> this a bug?

The dimensions of the table cell include padding, which by default is
6pt left and right, and 3pt top and bottom. You need to either override
that or allow extra space.

(Because the cell's left aligned, only the left passing is used to
position your drawing)

Matt Folwell

More information about the reportlab-users mailing list