[reportlab-users] RE: Infinite loop when table with Paragraph
overflows a page
David Fraser
reportlab-users@reportlab.com
Tue, 28 Oct 2003 14:37:45 +0200
Henning von Bargen wrote:
>>From: David Fraser <davidf@sjsoft.com>
>>To: reportlab-users@reportlab.com
>>Subject: [reportlab-users] Infinite loop when table with Paragraph
>>
>>
>overflows a page
>
>
>>Reply-To: reportlab-users@reportlab.com
>>
>>Hi
>>
>>More table layout issues ...
>>We've had trouble with the layout of a table with a large cell that
>>doesn't fit in the page.
>>If I run the attached test with numtests=6, the python process starts
>>using up loads of memory and CPU, eventually growing to at least 500MB
>>We don't neccessarily need to display all the data (as it doesn't fit),
>>but it would be nice if there was some way to trap this condition and
>>either (prefarably) truncate it or at least raise an error.
>>The test basically produces a table with three columns, one of which has
>>a paragraph in it with lots of text.
>>Successive tables with more and more text are produced. If you stop off
>>at numtests=5 (the default value), everything is fine.
>>
>>Any comments on where this might be in the code or how we can avoid it?
>>
>>Thanks
>>David
>>
>>
>>
>
>David, I've seen a similar problem using tables.
>It could be that the source of this is somewhere inside the Table
>implementation:
> def split(self, availWidth, availHeight):
> self._calc(availWidth, availHeight)
> if self.splitByRow:
> if self._width>availWidth: return []
> return self._splitRows(availHeight)
> else:
> raise NotImplementedError
>
>Try commenting out the line
> if self._width>availWidth: return []
>
>I did this for my own LongTable implementation.
>It will result in the table to be displayed (however,
>information gets lost because not all data fits on the page).
>
>
Hmmm ... no, the test still fails.
>This may also have something to do the line wrapping code
>in the Paragraph class, especially if the paragraph contains
>long words.
>
>
OK, I could have a look at that. But the words are all very short...
>You might also test my LongTable class.
>It works just like Table, but is designed for long tables.
>
>
Unfortunately it crashes on this one too... thanks though
David