[reportlab-users] drawing inside a table

Brian O'Reilly fade at deepsky.com
Fri Feb 25 12:51:44 EST 2011

On 11-02-25 06:10 AM, Robin Becker wrote:

> On 25/02/2011 10:10, Matt Folwell wrote:

>> 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)



> here is an example of drawing a barchart into a cell with automatic

> sizing; also we draw an image, but you'll need your own to make this work.

Thanks very much! That explains all of my current confusion. :)


More information about the reportlab-users mailing list