[reportlab-users] Table split

Robin Becker reportlab-users@reportlab.com
Tue, 15 Oct 2002 20:11:51 +0100

In article <20021015150135.7cdc2d8c.casey@zope.com>, Casey Duncan
<casey@zope.com> writes
>I've been working with some tables and ran into an issue where the table row 
>splitter was failing in a strange way. Basically the Table.split was returning 
>an empty list for some strange reason and after some debugging I found out why:
>Here is the split method for platypus Table flowables:
>    def split(self, availWidth, availHeight):
>        self._calc()
>        if self.splitByRow:
>            if self._width>availWidth: return []  <-- some strange reason
>            return self._splitRows(availHeight)
>        else:
>            raise NotImplementedError
>I marked the suspect line, which seems to be making the split fail if the table 
>is too wide. Commenting out this line corrects the problem, as would fixing my 
>table width I suppose (it is computed dynamically) , but this made no intuitve 
>sense to me.
>Why does the width of the table come into play during the row split?
I think the idea is that if it can't fit across then splitting won't
help so we fail early. A long wide table won't fit and two short wide
ones won't either.
Robin Becker