[reportlab-users] positionate flowable in frame ?!

Tamer Higazi th982a at googlemail.com
Thu Mar 27 00:33:36 EDT 2014


Hi!

I have red the Reportlab Guide, and I am not getting smart howto
positionate Flowables in a frame.
I have created a table, now I want to positionate the table to be
aligned right, but don't know how.

Is there a way to positionate flowables in a frame defining this with
the X,Y position ?!

And beside this proble, can somebody tell me how to set the cell's width ?!

Thanks for your support....


Tamer



from reportlab.pdfgen.canvas import Canvas
from reportlab.platypus import SimpleDocTemplate,
Paragraph,Table,Frame,TableStyle
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import inch
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet


class Invoice(object):

def __init__(self):
self.__styles = getSampleStyleSheet()
self.__Canvas = Canvas("MyFile.pdf", pagesize=A4)

#Header Frame
#int(round(A4[1]/5,0))

PPart = int(round(A4[1]/6,0))

#Frame(x1, y1, width, height)

#Logo Frame
self.__LFrame = Frame(
30,A4[1]-PPart,
A4[0]-60,PPart,
leftPadding=0, bottomPadding=0, rightPadding=0,
topPadding=0, showBoundary=0)

self.__LFrame.addFromList([Table([[0,1],[0,1]])],self.__Canvas)

#Header Frame
self.__HFrame = Frame(
30,A4[1]-(PPart*2),
A4[0]-60,PPart,
leftPadding=0, bottomPadding=0, rightPadding=0,
topPadding=0, showBoundary=0)

#Body Frame
self.__BFrame = Frame(
30,A4[1]-(PPart*5),
A4[0]-60,PPart*3,
leftPadding=0, bottomPadding=0, rightPadding=0,
topPadding=0, showBoundary=0)

#Footer Frame
self.__FFrame = Frame(
30,A4[1]-(PPart*6),
A4[0]-60,PPart,
leftPadding=0, bottomPadding=0, rightPadding=0,
topPadding=0, showBoundary=0)

TableX = Table([['Rechnungsnr.:','2000'],['Kundennr.:','2000']])

#Elemente setzen
prg = Paragraph("This is a heading Part
1",self.__styles['Heading1'])
prg2 = Paragraph("This is a heading, Part
2",self.__styles['Heading1'])

self.__HFrame.addFromList([TableX],self.__Canvas)

self.__Canvas.save()

def __delete__(self):
pass

InvoiceX = Invoice()


More information about the reportlab-users mailing list