[reportlab-users] Platypus headings
Saketh
saketh.bhamidipati at gmail.com
Fri Dec 15 15:52:56 EST 2006
On 12/15/06, Yordanka Budinova <d.budinova at gmail.com> wrote:
>
>
>
> 2006/12/15, Saketh <saketh.bhamidipati at gmail.com>:
> >
> > I am trying to create a page heading which is written onto each page.
> > However, I am having trouble drawing the header table before anything else
> > on the page. Instead of being a consistent header, everything except the
> > headers are drawn and then, on the final page, all of the headers are drawn
> > in sequence.
> >
> > How can I draw the heading table at the top of each page?
> >
> > Here is my attempt. (I have attached the module's full code, in case
> > that is necessary.)
> >
> > def pageTemplate(self, canvas, doc):
> > PAGE_WIDTH, PAGE_HEIGHT = canvas._pagesize
> > canvas.saveState()
> > canvas.setFont('Times-Roman', 12)
> >
> > # Draw page number
> > canvas.drawCentredString(PAGE_WIDTH / 2.0, inch / 2.0, "%d" %
> > doc.page)
> >
> > # Create title paragraph
> > pTitle = Paragraph(self.title, 12, 0, style=styles["Normal"])
> > pHeader = Paragraph(self.roottext, style=styles["Normal"])
> >
> > # Data for the header table
> > data = [(pTitle, pHeader)]
> >
> > headertable = Table(data, colWidths=(4 * inch, 4 * inch),
> > style=self.headerstyle)
> >
> > headertable.setStyle(self.headerstyle)
> > headertable.hAlign = 'LEFT'
> > self.story.append(t)
> >
> > canvas.restoreState()
> >
> > Thanks in advance.
> >
> > _______________________________________________
> > reportlab-users mailing list
> > reportlab-users at reportlab.com
> > http://two.pairlist.net/mailman/listinfo/reportlab-users
> >
> >
> >
> > Hi, Saketh,
> If I understand, you need to repeat some rows as header on each page.
> Add "repeatRows = n" in Table:
>
> t = Table(self.val, colWidths=self.cw,
> style=TableStyle(tst),
> repeatRows=1)
>
>
> --
>
> Regards,
> Dani
>
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>
>
> That is not working for me.
I have tried to use handle_pageBegin in my template, but the header is not
drawn to the beginning of each page. It is instead drawn at the end of the
document.
I have attached a revised version.
Once again, thanks for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20061215/7ab3a3be/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: writer.py
Type: text/x-python
Size: 9632 bytes
Desc: not available
Url : http://two.pairlist.net/pipermail/reportlab-users/attachments/20061215/7ab3a3be/attachment.py
More information about the reportlab-users
mailing list