[reportlab-users] Bit of help with wrapping text in a paragraph

Bill W reportlab-users@reportlab.com
Mon, 10 Feb 2003 14:41:27 -0800


I'm using platypus (why? is that a little overkill?)
I'm reading a bunch of info from a db, and then displaying.
Something like:

#try paragraph
styleSheet = getSampleStyleSheet()
style = styleSheet['Normal']  #make own here
lotsatext = str(line['description'])
P=Paragraph(lotsatext, style)
aw = 3*inch
ah = 2*inch
w,h = P.wrap(aw, ah)
P.drawOn(c, x*inch+2*inch, y*inch)


This appears to work, as long as there are spaces in 'lotsatext'.
If there are no spaces, it won't do any line breaks although it
still appears to calculate where they *should* appear.

Bill.



-----Original Message-----
From: reportlab-users-admin@reportlab.com
[mailto:reportlab-users-admin@reportlab.com]On Behalf Of Ian Sparks
Sent: Monday, February 10, 2003 11:31 AM
To: reportlab-users@reportlab.com
Subject: RE: [reportlab-users] Bit of help with wrapping text in a
paragraph


Are you using Platypus or just the basic canvas methods?

- I.

-----Original Message-----
From: Bill W [mailto:bwitherspoon@emseal.com]
Sent: Monday, February 10, 2003 5:18 PM
To: reportlab-users@reportlab.com
Subject: [reportlab-users] Bit of help with wrapping text in a paragraph


I'm having an excellent time using pdfgen (dl'ed yesterday).
I'm stuck on how exactly to wrap the text in a paragraph.

Basically, I want the following text:
'dslkfjlkjfkjsalfjasldfjlasjdflajsfljaslfjasldfjalsjfklaksdjf'

to wrap (in a paragraph size of my choosing) to:
'lksdjflajsdflajsdfj
lsdjflakjsdflkjasdlf
lajflkajsdflkjasldkf'

I've read the docs on flowables, but it isn't quite speaking to me. ;-)
The only thing I found on google was some 'over the top' code for wrapping
text around a picture, which is a bit beyond what I'm after.

Any help would be appreciated muchly.

Bill.
_______________________________________________
reportlab-users mailing list
reportlab-users@reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users
_______________________________________________
reportlab-users mailing list
reportlab-users@reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users