[reportlab-users] Handling of too long entries in Table
Tue, 15 Oct 2002 15:47:40 +0100
In article <firstname.lastname@example.org>, Willi Richert <email@example.com> writes
>I tried the following solution:
>- data is a 2-dim array with strings in it
>- For each data-element I generate a Paragraph object and see which size it
>- Paragraph has the member getActualLineWidths0() which shall return a list of
>the line widths.
>But: When I try to do this I get:
>raceback (most recent call last):
> File "movatisreport.py", line 135, in ?
> t = tf.getTable(data)
> File "movatisreport.py", line 85, in getTable
> File "/usr/lib/python2.2/site-packages/reportlab/platypus/paragraph.py",
>line 737, in getActualLineWidths0
> w.append(self.width - frag.extraSpace)
>AttributeError: 'tuple' object has no attribute 'extraSpace'
>The frag contains. e.g. the following at runtime:
>which of course has no extraSpace member.
>Is this a bug? If not, is it possible to get the width of the splitted
>This problem can't be so difficult.
well this is an experimental method as is indicated by the 0 at the end of the name also whoever
wrote it didn't appreciate that we have two forms of broken line.
"""Convenience function; tells you how wide each line
actually is. For justified styles, this will be
the same as the wrap width; for others it might be
useful for seeing if paragraphs will fit in spaces."""
assert hasattr(self, 'width'), "Cannot call this method before wrap()"
func = lambda frag, w=self.width: w - frag.extraSpace
func = lambda frag, w=self.width: w - frag