[reportlab-users] Line splitting for long tables

Robin Becker robin at reportlab.com
Thu Oct 22 05:17:25 EDT 2009


Benjamin Higgins wrote:

> Hey,

>

> We've been using ReportLab with great results except for one hang-up -- we

> have some tables that are too wide for the page sometimes. It's caused by

> long text in one of the cells. We need a solution for splitting text to

> multiple lines so that the table will fit on the page. Any suggestions on

> how to do this, even a rudimentary solution? I'm thinking of writing an

> algorithm myself to split long text to multiple lines but I'm sure it's not

> going to be very good.


Table cells can contain flowables or lists of flowables so you can use paragraph
flowables inside them. Alternatively if using Paragraphs is too heavy there's a
simpleSplit function in reportlab/lib/utils.py that may do what you want. Of
course any kind of splitting mechanism requires that we know the desired width,
font, font size etc etc.
--
Robin Becker



More information about the reportlab-users mailing list