[reportlab-users] prevent paragraph splitting up

Andy Robinson andy at reportlab.com
Tue Jul 11 11:52:59 EDT 2006


Remi Cool wrote:
> Hello,
> 
> It's converted by a script to a sorta RML thats fed to platypus ....
> that part works like a charm, except sections still get broken up so
> that ie. the header is on one page and the text on the other. Is there a
> way to let the paragraph know that it must not split so that the
> complete section is printed on the next page?
> 

In your sorta-RML, make a sorta-one-cell-table.  This should "sort" it 
because table cells cannot be split yet ;-)

<table><tr><td>
    <h2>This is section 1</h2>
    <p>This is section 1 text</p>
</td></td></table>

The code will look a bit yucky since you initialise a table with a 2d 
array of data.  And in this case the one-and-only cell should be a list 
of flowables.  Sort of like this
tbl = Table([[[p1, p2, p3, p4...]]])
story.append(tbl)

Good luck,

Andy





More information about the reportlab-users mailing list