[reportlab-users] Handling of too long entries in Table

Willi Richert reportlab-users@reportlab.com
Tue, 15 Oct 2002 15:55:54 +0200


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:
(177.11000000000001, ['Customer']),
which of course has no extraSpace member.

Is this a bug? If not, is it possible to get the width of the splitted 
paragraph differently?

This problem can't be so difficult.


On Tuesday 15 October 2002 15:43, Robin Becker wrote:
> In article <200210151210.59773.w.richert@gmx.net>, Willi Richert
> <w.richert@gmx.net> writes
> >Hi,
> >
> >I need to generate a table out of unknown data. The problem is that the
> >entries can get too long for a DIN A4 page. I tried here and there but
> > didn't get a proper solution.
> >
> >What would be the best way to solve this problem?
> >
> >willi
> Unfortunately we don't propagate splitting to the cell level which I
> think is what is needed.
> The problems with splitting are bad enough :( and this requires the
> table to function somewhat differently. I suppose we need an extra
> escape mechanism that comes into play whenever a single cell is too
> large for example we could then let the table duplicate the row and
> split the contents of the original into two. That will work for things
> which are splittable, but some things (images) are not splittable.
> Anybody else have any ideas. Perhaps we need a forcible split api