[reportlab-users] table header

Robin Becker reportlab-users@reportlab.com
Sat, 12 Oct 2002 15:40:10 +0100


In article <878z14gcpq.fsf@flibuste.net>, William Dode <wilk-
ml@flibuste.net> writes
......
>
>for the page header, i used onPage=myheader
>but on myheader i don't know which row is curently print in the current
>page...
>
>shall i use a different pagetemplate for each break ? but i will need to
>break the page each time...
>
>thanks
>
An easy way to do this is to have a draw time variable that's altered by
the things that you draw.


so something like

from reportlab.platypus import Macro
dtInfo = None
class myMacro(Macro):
        def __init__(self,info):
                self.command = 'dtInfo=%s' % repr(info)
                self.info = info
        def draw(self):
                global dtInfo
                dtInfo = self.info
#test
m=myMacro('aaaaaaa')
m.canv = None
print dtInfo
m.draw()
print dtInfo

You can then add these to your story and use one or other of the page
hooks to do something with it.
-- 
Robin Becker