[reportlab-users] Long strings without spaces exceed the page margins
Andy Robinson
andy at reportlab.com
Wed Jul 14 05:27:09 EDT 2010
On 13 July 2010 18:06, Tim Roberts <timr at probo.com> wrote:
> Now, if you dig in to this and come up with a good extension to
> ReportLab for generating optimal column widths from a given data set,
> I'm sure the ReportLab folks would be tickled pink to include it in the
> package. However, you'll quickly find out how hard of a problem that
> is. HTML has had the <table> tags since the very first version some 20
> years ago, and to this day the browsers can't all agree on the layout in
> every case.
Thanks, Tim!
The real problems come with row/column spanning, nested tables and
page breaks. If one excluded those, a lot more could be done with
automatic table sizing. But in my experience it's usually
developers who want this, not the ultimate readers of a document, and
there is always a common sense compromise.
But if you have very specific needs in very specific situations it's
best to use our stringWidth function and prepare blocks of
preformatted text, or strings with '\n' inside. For pathnames,
replace '/' with '/ ' (a space) and they will wrap OK and make sense
to the reader - they just won't be easily pasteable.
For hyphenation, check out the 'wordaxe' project which can be added
into ReportLab...
- Andy
More information about the reportlab-users
mailing list