AW: [reportlab-users] setting Style for a Sum in a Table

Robin Becker reportlab-users@reportlab.com
Thu, 17 Oct 2002 18:37:09 +0100


In article <FDEJJKLBELAKNCMDIADEMEOFCCAA.Jo-Bader@gmx.de>, Jo-
Bader@gmx.de writes
>
>does the table know when its splitting will occure for the last time ?
>So tablestyle-commands which dependent upon the tabelend
>can maybe be set at that time....
>
>jo
When the split happens the splits are cast adrift; effectively the
splitting table cannot know what the results will be used for.

The first part of a split could be informed that it isn't last, would
that do?

Tables have an overrideable onSplit method

class MyTable(Table):
        def onSplit(self,T):
                if not hasattr(self,'_IAMSPLITTING'):
                        T._splitpart=0
                        self._IAMSPLITTING=1
                else:
                        T._splitpart=1
                        del self._IAMSPLITTING

        def draw(self):
                # _splitpart 
                #       None    never was split
                #       0       am the leading part of a split
                #       1       am the last part of a split
                _splitpart = getattr(self,'_splitpart',None)
                #... do stuff with this knowledge
                Table.draw(self)

I'm fairly sure the above would work, but I haven't tested it.
-- 
Robin Becker