[reportlab-users] Reducing the margin of a table

Robin Becker robin at reportlab.com
Thu Jun 30 06:15:27 EDT 2005

Claudio Battaglino wrote:
> In your example, if you don't specify rowHeights you have a bottom margin.
> The User Guide says:
> "The rowHeights argument is a sequence of numbers or possibly None, 
> representing the heights of the rows....A value of None means that the 
> corresponding row height should be calculated automatically".
> The following table, for example, doesn't fill the page.
> So I must specify rowHeights.
> I thought this was done automatically.
> t = Table([['This is a single cell table']],
>                 colWidths=PAGE_WIDTH,
>                  style=TableStyle([
>                         ('LEFTPADDING',(0,0),(-1,-1), 0),
>                         ('RIGHTPADDING',(0,0),(-1,-1), 0),
>                         ('BOX',(0,0),(-1,-1), 0.1, colors.blue),
>                         ],
>                     ),
>                  )
> However I solved the problem specifying rowHeights.
> I don't like it but it works.
> Thank you very much for your help.
> claudio :-)
.... unfortunately when we calculate row heights automatically we try to find 
the minimum row height that will suffice. The alternative which you suggest 
would be a bit silly as each row would automatically fill up all remaining space 
in the frame and we'd need to split every table etc etc. I agree that in the 
specific case when the overall table size is fixed then it may be sensible to 
grow rows to fill up the required space. We haven't catered for that case.

Robin Becker

More information about the reportlab-users mailing list