[reportlab-users] Platypus headings

Yordanka Budinova d.budinova at gmail.com
Fri Dec 15 03:47:21 EST 2006


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20061215/e22ddc05/attachment.html


More information about the reportlab-users mailing list