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

Erik Westra reportlab-users@reportlab.com
Mon, 16 Jun 2003 08:21:19 +1200

Hi there,

I suspect the answer to this question is "it can't be done", but I thought 
I'd ask anyway...

I'm using a platypus.Table object to represent a list of job details for 
courier deliveries, where each delivery takes up two rows in the table, and 
a horizontal line drawn between each individual job, like this:

    Date&Time   Pickup                  Dropoff
    ---------   --------------------    --------------------
    27/3/2003   AMI Limited             CDHQ
    8:19 AM     126 Pickworth Street    66 Starbuck Drive
    ---------   --------------------    --------------------
    27/3/2003   Residence               AMI Limited
    10:04 AM    902 Buckland Rd         126 Pickworth Street
    ---------   --------------------    --------------------

There can be hundreds of these in a single table (they need to be a single 
table so that all the columns line up), and I'm using a platypus.Table so 
that the table nicely breaks across page boundaries, and automatically 
redisplays the header cells at the top of each page.

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.

So, my question is: is there any way of adding something like a "keep with 
previous row" style to a platypus.Table so that the page breaks occur at a 
reasonable point?  I see that there's a KeepTogether object that forces 
individual Flowable objects to stay on a single line, but that doesn't help 
in this case as I need to keep certain rows of a table together.

Any ideas?  Could I, perhaps, create a subclass of platypus.Table and 
override the split() method in some way?


  - Erik.