[reportlab-users] table width / column width

Andy Robinson andy at reportlab.com
Thu Mar 9 04:39:21 EST 2006


Chris Schleiermacher wrote:
> hi community,
> 
> these questionis, which i cannot solve by reading the docu,
> are about table with and column width.
> 
> if i create a table with two columns, each row
> containing only a very short text, the resulting table
> has a width of say 3cm.
> 
> Q1) how can i force the table to stretch over the complete
>     page width?

pass a keyword argument to the table constructor:
   colWidths=[width1, width2]

You'll have to work out width1 and width2 yourself as it
doesn't know the width of the enclosing frame when it is constructed.
> 
> Q2) how can i force column 1 to have a width X and column 2 
>     to have a width Y.
Same answer.

I'm pretty sure colWidths is documented but if not, please let us know! 
  Have you also seen the test scripts in

    reportlab\test\*tables*.py
which generate MANY tables in different styles and have runnable code 
examples to look at.

Best Regards,


Andy Robinson


More information about the reportlab-users mailing list