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

reportlab-users@reportlab.com reportlab-users@reportlab.com
Fri, 18 Oct 2002 14:39:36 +0200


its seams to work when setting to the amount of rows -1 .
but i am not sure

# setting Style of the last row in a splitted table on the latest page
self.tStyle.add('BACKGROUND', (0 ,nDataRows-1), ( -1, nDataRows-1),
colors.darkgray)

# setting Style of the last row in a splitted table on each page
self.tStyle.add('BACKGROUND', (0 ,         -1), ( -1,          -1),
colors.darkgray)



regards

Jo



-----Ursprüngliche Nachricht-----
Von: reportlab-users-admin@reportlab.com
[mailto:reportlab-users-admin@reportlab.com]Im Auftrag von Robin Becker
Gesendet: Donnerstag, 17. Oktober 2002 19:37
An: reportlab-users@reportlab.com
Betreff: Re: AW: [reportlab-users] setting Style for a Sum in a Table


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
_______________________________________________
reportlab-users mailing list
reportlab-users@reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users