[reportlab-users] Howto work with 2 frames with different content
Paul Boots
rl at bootsch.demon.nl
Wed Jun 29 18:46:11 EDT 2005
Thank so much Amit,
I saw your question just after my post ;-) , but this answer is perfect!
At 10:01 -0700 29/6/2005, Amit wrote:
>Hi there,
>
>I just had similar problems and it took me sometime to figure out the
>entire thing. The documentation that comes with reportlab is not very
>comprehensive, although it does provide you with a lot of examples.
>Another tip of learning this will be to look at
>http://developer.reportlab.com/examples.html , you can easily write
>out python code from the RML examples. But anyways as for your I
>problem I have the solution for you. First of all, I would like you to
>understand that you will be using PLATYPUS instead of pdfgen.
>
>def createPlatypusPage(pieChart1, pieChart2, table1):
> # PDF Properties
> Title = "ECS Report #1"
> Author = "ECS Information Systems"
> PageInfo = "Sample Report"
>
> # define frames - for frames in page
> frameHeader = Frame(x1=0*inch, y1=7.5*inch, width=11*inch, height=1*inch)
> frameChart1 = Frame(x1=0*inch, y1=2.5*inch, width=5.5*inch, height=5*inch)
> frameChart2 = Frame(x1=5.5*inch, y1=2.5*inch, width=5.5*inch, height=5*inch)
> frameTable1 = Frame(x1=0*inch, y1=0*inch, width=5.5*inch, height=2.5*inch)
> frameTable2 = Frame(x1=5.5*inch, y1=0*inch, width=5.5*inch, height=2.5*inch)
>
> # define pageTemplates - for page in document
> mainPage = PageTemplate(frames=[frameHeader, frameChart1, frameChart2,
> frameTable1, frameTable2])
>
> # define BasicDocTemplate - for document
> doc = BaseDocTemplate('report_1.pdf', pagesize=landscape(letter),
> pageTemplates=mainPage, leftMargin=72,
> title=Title, author=Author, showBoundary=0)
>
> # styles
> styles = getSampleStyleSheet()
> styleH = styles['Heading1']
>
> # create a story
> story = []
> heading = Paragraph("This is a Heading for the Report", styleH)
> heading.hAlign = 'CENTER'
> pieChart1.hAlign = 'CENTER'
> pieChart2.hAlign = 'CENTER'
>
> story.append(heading)
> story.append(FrameBreak()) # move to next frame
> story.append(pieChart1) # note that frame order is based upon order
>used in PageTemplate
> story.append(FrameBreak()) # move to next frame
> story.append(pieChart2)
> story.append(FrameBreak()) # move to next frame
> story.append(table1)
>
> doc.build(story)
>
>This is quite straightforward and the comments, I hope, will be quite
>helpful. Anyways if you have any questions please post again.
>
>Thanks,
>Amit
>
>On 6/29/05, rl at bootsch.demon.nl <rl at bootsch.demon.nl> wrote:
>> Hi All,
>>
>> After looking at the demo/examples, the docs and code I'm still missing something.
>>
>> I want pages with two frames, on the left a topic list, the right frame for the content.
>> I would like to use BaseDocTemplate as base for my class but I can figure out how
>> to do this.
>>
>> Another option seems to be to use the 'Frame.addFromList' method, but that will
>> give me other problems.
>>
>> Any help would be much appreciated
>> --
>> Vriendelijke groet,
>> Paul
>> _______________________________________________
>> reportlab-users mailing list
>> reportlab-users at reportlab.com
>> http://two.pairlist.net/mailman/listinfo/reportlab-users
>>
>_______________________________________________
>reportlab-users mailing list
>reportlab-users at reportlab.com
>http://two.pairlist.net/mailman/listinfo/reportlab-users
--
Vriendelijke groet,
Paul
More information about the reportlab-users
mailing list