[reportlab-users] Unconditionally split a string at the end of a cell.

Tim Roberts timr at probo.com
Fri Jan 6 13:33:52 EST 2012


Martin Weissenboeck wrote:

>

> I have a paragraph like

>

> p = Paragraph('ABCDEFG',styleN)

>

>

> The string does not contain any spaces.

> This paragraph becomes part of a table. Width of the column is (e.g.)

> 5*mm.

> I expected the text to be broken in some lines. But there is always

> one line.

> ...

> I think there should be a simple way to unconditionally split a string

> at the end of a cell.


Nope. There are no universally acceptable rules to follow on how to do
this kind of splitting. This is a relatively unusual thing to want --
it's an exception condition.


> Any ideas?


You will have to do it by hand, embedding the rules YOU want the thing
to follow. It's not really that hard. You just add a character at a
time until the current string fits. If the strings are long, you could
use a binary search, but if they're short, a character at a time is fine.

--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20120106/00f5e072/attachment.htm>


More information about the reportlab-users mailing list