[reportlab-users] RE: Keeping rows of a table together?

Henning von Bargen reportlab-users@reportlab.com
Mon, 30 Jun 2003 10:04:03 +0200


> From: Erik Westra <ewestra@wave.co.nz>
> Subject: RE: [reportlab-users] Keeping rows of a table together?
> Reply-To: reportlab-users@reportlab.com
> 
> Hi Andy,
> 
> > > Now, the problem is that when Flowable.split() is called to break
> > > the table
> > > across page boundaries, the three rows that make up each delivery
often
> > > appear on separate pages, which is rather ugly.
> >
> >There's a lazy way to do it.  Make an outer big table with ONE
> >column.  Inside the first row put a 3-column, 1-row table with your
> >headers.  This will then repeat on each page. Then, make a separate
> >3-row, 3-column table for each of your deliveries and put it in the
single
> >cell of the next row down.  I THINK this will work.  If not and
> >it splits the second-level tables, then make the second level
> >tables 3 distinct one-row objects with the same style and put a
> >KeepTogether around them.
> 
> Hmmm...I can see two problems with this.  Firstly, by having the data in 
> separate sub-tables, you lose the ability to have the table calculate the 
> column sizes automatically.  
> Secondly, wouldn't the above take a lot of 
> extra processing time?  I'm already a bit worried about the length of time

> it takes to generate a PDF file out of a complicated set of underlying 
> data, and if we add lots of nested objects won't it slow down the 
> report-generation process a lot?

Hi Erik, I sent a modified Table class to Robin Becker in April/May.
The current implementation has O(rows^2) whereas the modified version
only has O(rows) and thus is a lot faster for long tables.
The modification also involved the auto-sizing algorithm, so
you'll have to see if it works for your application.
HTH
Henning