bonjour
j'ai crée un tableau avec report lab je veux le mettre en tan que pied de page (footer) avec le num de page ,
voici le code qui permet d’énumérer les pages
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
def footer(canvas, doc):
    footer_bottom = doc.bottomMargin
    canvas.saveState()
    canvas.setFont('Helvetica',9)
    text = "Page %d" % doc.page
    canvas.drawString(inch, footer_bottom, text)
    canvas.restoreState()
frame = Frame(doc.leftMargin, doc.bottomMargin, doc.width, doc.height,)
template = PageTemplate(id='footer', frames=frame, onPage=footer)
doc.addPageTemplates([template])
maintenet je veux bien ajouter un tableau que j'ai crée d'avance en pied de page à droite
code du tableau
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
data1=[[Paragraph(centre,styles["Romain"]),
       Paragraph(marque,styles["Line_Label_Center"]),
       Paragraph(energie,styles["Line_Label_Center"]),
       Paragraph("MV",styles["Line_Label"])],['','',
       Paragraph(m,styles["Line_Label_Center"]),
       Paragraph("Gy/min",styles["Line_Label"])],['',
       Paragraph(model,styles['Line_Label_Center']),
       Paragraph("2012-62458", styles['Line_Label_Center']),
       Paragraph("s/n", styles['Line_Label'])], ['',
       Paragraph("Pysicien", styles['Line_Label']),
       Paragraph(physiscien, styles['Line_Label_Center'])],[
       Paragraph("BUNKER1",styles['Line_Label_Center']),
       Paragraph("Date",styles['Line_Label']),
       Paragraph(date,styles['Line_Label_Center']),
]]
t33 = Table(data1,colWidths=(3*cm,2*cm,2.3*cm,2*cm),hAlign='RIGHT',rowHeights=0.6*cm)
t33.setStyle([('INNERGRID',(0,0),(-1,-1),0.1,colors.black),
            ('BOX',(0,0),(-1,-1),0.3,colors.black),
            ('SPAN',(1,0),(1,1)),
            ('SPAN',(2,3),(3,3)),
            ('SPAN',(2,4),(3,4)),
            ('SPAN',(0,0),(0,3)),
            ('ALIGN',(0,0),(-1,-1),'CENTER'),
            ('VALIGN',(0,0),(-1,-1),'MIDDLE'),
            ('FONT',(0,0),(0,0),'Helvetica',9)
 
 
            ])
rapport.append(t33)