[reportlab-users] tables - width and length of columns and infinite looping

John Duperon reportlab-users@reportlab.com
Fri, 26 Dec 2003 13:13:01 +0100

Hello all,

I have a question regarding tables.  Most of the data that I work with 
is from a database and is not a set length or may involve several pieces 
of data put together.  If I merely give this data to a table without 
setting columns widths, the widths will adjust automatically to what 
they need to UNLESS the table gets close to overrunning a page.  In this 
case, the table creation code infinitely loops.  What I've done to get 
around this is to set the widths of the columns to a size that will 
accomodate my headers.  Then, I have a wrapping function (which I can 
post here, if anyone would like it) that counts how many characters are 
in a line of data and inserts line breaks.  This is fine, except that 
text is not of a uniform size.  If I have a line of i's, these take up a 
lot less space than a line of O's.  Sometimes the data overruns my 
column borders and on to the text of the nearby column and I have to 
make sure I up the amount of buffer space.  

What I'd like to know is if this infinite looping is a known issue. 
 Also, is there a way to ask a table how tall or wide it thinks it will 
be?  I've heard that tables that are longer than 25 pages or so tend to 
crash ReportLab, so it might be nice to know how big the table will be 
so that I can tell ReportLab to break it into smaller tables.  From what 
I've read in this group, breaking a large table into smaller ones also 
makes rendering faster.

Many thanks in advance,

John Duperon