python - how to group objects in reportlab, so that they stay together across new pages -


i'm generating pdf files using reportlab. have section repeated. contains of header , table:

            story.append(paragraph(header_string, styleh))             story.append(table)  

how can group paragraph table (in latex put them same environment) in case of page brake, paragraph , table stay together? paragraph floats @ end of 1 page , table starts on top of next page.

you can try put them in keeptogether flowable, so:

story.append(keeptogether([paragraph(header_string, styleh), table]) 

however aware that, last checked, implementation not perfect , still split items frequently. know job of keeping single flowable otherwise split, if say:

story.append(keeptogether(paragraph(header_string, styleh)) 

then paragraph not split unless impossible not be.

if keeptogether doesn't work you, i'd suggest creating custom flowable paragraph , table inside , during layout make sure custom flowable subclass not allow split up.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -