[reportlab-users] Word wrapping within table cells

Greg Rogers grogers at storediq.com
Fri Mar 16 18:10:33 EDT 2007

I asked about word wrapping the other day. Henning von Bargen told me
about deco-cow. It looks pretty good, but I needed something very
simple and with a bit of control.

Here's a patch that adds a little bit of optional intelligence to the
CKJ word wrapping algorithm.

The addition is the notion of a preferred list of characters on which to
break the word. This allows breaking on punctuation characters like
comma, dash, period, etc. As you might guess, this is useful for
special text that is expected to have imbedded characters which are
natural break points. For example a table cell with file system paths
would be best split just after a slash.

A default set of perferred characters is provided, but you can easily
provide your own.

There's a test case that demonstrates the use.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20070316/8a4e5f04/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reportlab.patch
Type: application/octet-stream
Size: 13364 bytes
Desc: reportlab.patch
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20070316/8a4e5f04/attachment.obj>

More information about the reportlab-users mailing list