[reportlab-users] Re: Refresh of SimpleDocTemplate

Robin Becker reportlab-users@reportlab.com
Thu, 1 May 2003 09:15:56 +0100

In article <00FFB5EA81D6D51196B60008C7C9BFD3134C1585@ntexchg1.conseco.co
m>, Wilgus, Jeff <Jeff_Wilgus@Conseco.com> writes

Doing the imports is not the problem so far as I can tell. The thing
that decides what is a first page etc is the template object and you
seem to be creating that in your BuildTheReport function. What I cannot
see is what happens around that. 

You might try calling doc.setProgressCallBack(func)

where func is something like

def myCB(msg):
    print msg

That will give some idea of what's going on during the document build.
>    Robin, 
>    Sorry, but I did not want to send the whole program. 
>    To your comments specifically: 

>    1)  "Elements" is a list defined in my module vReport.py ... it 
>    actually is the "story" that is being passed to the build function 
>    ... doc.build(Elements, onFirstPage=myFirstPage, 
>    onLaterPages=myLaterPages) ...  The code that I sent in my original 
>    post was showing just the portion of the code, that portion where 
>    the imports for reportlabs objects and the "Elements" object was 
>    initialized (and a PageBreak() appended).  Then the variables which 
>    are set to seed the myFirstPage function. etc.
>    2) The main() then basically goes through a process of calling a 
>    two functions called CreateReport() and AddDataToReport() for each 
>    server in a for loop.  The BuildTheReport() funciton was called 
>    just once at the end of the for loop.  I want to bring the 
>    BuildTheReport() function within the for loop so one report PDF is 
>    created for each server.
>    3) I've tried re-initializing the "story" ... Elements = [] and 
>    append a PageBreak() ... at the top of the for loop and the results 
>    are what I've described.  All Reports create as expected (no 
>    errors), but reports 2 - n "blend" the title page with the first 
>    page.  It's as if it is recognizing both "First" and "Later" on 
>    that first page.
>    4) Since the program is using "from" imports, I cannot easily 
>    reload() the reportlabs objects.      
>    I hope this clears things up a little without actually sending the 
>    whole program. 
>    I'd appreciate anything you or anyone else can add. 
>    Thanks so much. 
>    Jeff 

Robin Becker