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

Ian Sparks reportlab-users@reportlab.com
Mon, 10 Feb 2003 14:54:26 -0500


No, I think Platypus is the way to go. You'd have to do a lot more =
legwork if you wanted to drive the canvas directly even for your simple =
case.


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


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 =3D getSampleStyleSheet()
style =3D styleSheet['Normal']  #make own here
lotsatext =3D str(line['description'])
P=3DParagraph(lotsatext, style)
aw =3D 3*inch
ah =3D 2*inch
w,h =3D 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
_______________________________________________
reportlab-users mailing list
reportlab-users@reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users