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

Erik Westra reportlab-users@reportlab.com
Tue, 17 Jun 2003 05:56:04 +1200


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?

Anyway, I'll have a play and see if I can get this going at a reasonable speed.

> > Any ideas?  Could I, perhaps, create a subclass of platypus.Table and
> > override the split() method in some way?
>
>If you were brave, yes :-)

Depending on the response from my boss, I may have to be...as you hint the 
code here is rather complex, so I'm hoping I can avoid this, but that may 
be the way I have to go.  Anyway, thanks for the suggestions!

Cheers,

  - Erik.