[reportlab-users] allow multiline text

Paul Barrass paul.barrass at safeonlinebilling.com
Tue Oct 21 06:16:31 EDT 2008

giulia cherubini wrote:



> It puts it onto a grid (attach1) or a simple canvas.drawLine(attach2)


> But when the text it is too long, it goes ‘’’outside the paper’’’

> (attach1) or over the text beside (attach2)


> Does some way – method exists to allow my text to go in the line below

> after a tot. number of letters?


The way I do this is to use a Table (as you have done in your attach1),
but wrap each cell of the Table within in a Paragraph. The Paragraph
has logic for splitting the text onto multiple lines. If you're dealing
with lots of cells, you may wish to consider only using the Paragraph
for cells likely to be long, as there is a small overhead with the
Paragraph, and there's no point taking the hit if you don't need to.

Alternatively, if you wish to split the text yourself, just use a
newline (\n) in the text - this forces a line break.

Paul Barrass.

More information about the reportlab-users mailing list