[reportlab-users] Long word in paragraph in table cell
Simon Metson
s.metson at bristol.ac.uk
Thu Aug 30 18:17:35 EDT 2007
Hi,
>> I'm writing a document using Reportlab, and so far so good.
>> However, I
>> have a table, whose contents are paragraphs (though there's no need
>> for them to be). The contents of some of the table cells will be long
>> strings without spaces, strings longer than the width of the cell.
>> I'd
>> like a way to automatically split the string, at the width of the
>> cell
>> minus any padding. Is there a way to do this?
Thanks for the quick Tim.
> Not automatically; ReportLab doesn't yet do hyphenation.
Dang! ;)
> If I were doing it, I'd probably write my own paragraph class derived
> from Paragraph, and check for these long words by hand. It
> wouldn't be
> easy, but it could be done.
Ok, will see what I can come up with. Is there an easy way to work
out how long the string is once it becomes rendered? The wrapOn seems
to do it, guess I could make a (fake) canvas object the size I want
the HyphenatedParagraph to fill and wrap the text with that. Will
give that a go tonight...
Cheers
Simon
More information about the reportlab-users
mailing list