[reportlab-users] Splitting paragraph in table cell on '-' as well as white space

Henning von Bargen H.vonBargen at t-p.com
Wed Jan 19 12:28:58 EST 2011

Richard Galka <rgalka at seccuris.com> wrote:

> I noticed a question about breaking words/strings within a

> table via special characters occurred last month.

> This is something that we implemented and works well

> in our environment.


> To ensure long words would break across tables,

> we subclassed the Paragraph class and modified the 'breakLines'

> method to either break on special characters or by using a

> dictionary file (www.gutenberg.org/ebooks/3204 in particular).


> We are using ReportLab 2.4, and subclassed the Paragraph class

> adding two methods (breakOnSyntax and breakWithDictionary) and

> overriding the original Paragraphs __init__ and breakLines

> methods.


> Hopefully this can help someone out, and again, please remember

> this is for ReportLab 2.4 and may not be relevant for other

> versions.

> ...

> code

> ...

You may want to try wordaxe as well
(see http://sourceforge.net/projects/deco-cow/).
It has a Paragraph replacement which supports automatic
hyphenation (using the Open Office dict files) when line-breaking.

The breaklines code in there is quite complex, but basically
it's the same idea as you use in your code.


More information about the reportlab-users mailing list