[reportlab-users] Re: Formatting long tables

Robin Becker reportlab-users@reportlab.com
Thu, 1 May 2003 18:16:07 +0100

In article <000901c30ff7$30768bc0$0301a8c0@auenland.org>, Henning von
Bargen <h.vonbargen@cityweb.de> writes
>I make the following assumption for long tables:
>The available width is equal in all frames where table is going to be
>Otherwise your layout is a mess anyway (but you could still fix all column
..... reasonable
>When auto-calculating column widths:
>In a table with M columns, assume that
>the width is not specified for m columns.
>The existing approach (as I understand it)
>is to divide the remaining available width by m,
>so that all unspecified column widths are equal
>and the table fills the available width exactly.
.... this is the one that's not strictly true.
Assume M columns with m unspecified. If the data defines some of the
widths for the unspecified ones then these become known and a reduced
number say m' <= m are used in the equal split. The problem arises when
one or more of the cells has a tradedoff between width & height. The
containing column then has no fixed width.
>Auto-sizing column widths should better happen
>only once, the first time wrap() is called.
>From then on, all column widths should be considered fixed.
possibly genius sampling algorithm elided

Suppose there were 300 rows in which one of the unknown columns had a
min requirement all determined by the contents. Using that as a fixed
width is fine if all succeeding rows have smaller width for that column.
A global algorithm might work in that case. 
Robin Becker