[reportlab-users] Table and document widths

Robin Becker reportlab-users@reportlab.com
Tue, 6 Jan 2004 15:26:30 +0000


In article <20040106133204.GA1255@gbdirect.co.uk>, Will Newton
<will@gbdirect.co.uk> writes
>On Tue, Jan 06, 2004 at 01:12:32PM +0000, Robin Becker wrote:
>> >
>> ..... can you create a simple example showing the effect and post it to
>> the list or direct to me.
>
>I have attached a reasonably simple example. The second table is
>noticeably wider.
>
>
>[ A MIME text / plain part was included here. ]
>
OK I see what's the problem. The doc width isn't really true. Inside
each doc are multiple page templates and each template contains frames.
What you really want to do is to use frame.width/2, but in the simpledoc
class the frames are actually not created until build time.

Unfortunately the default frame has internal padding of 6 points left &
right, top & bottom. So even though our frame sits flush in the page
template there is a 6 point margin inside it.

When you specified the width you actually ignored the padding and though
this should cause a packing error it doesn't 'cos someone got mad in the
past and turned off certain kinds of errors.

You can see this better by trying showBoundary=1 ie

doc = reportlab.platypus.SimpleDocTemplate("test.pdf",showBoundary=1)

When you don't specify a width the Table wrap method creates them
automatically to fill up the offered width (ie the available
framewidth).
-- 
Robin Becker