[reportlab-users] How do I left-align my table?

Matthew Wilson matt at tplus1.com
Wed Nov 19 11:36:09 EST 2008

I have a small table and it is displayed in the center of the page.
How can I have it line up on the left margin like my paragraphs? I
understand how to mess with stuff inside the various table cells. I
don't care about that. Instead, I want to push the whole table box to
the left.

Here's the code I'm using:

def tfun(title, dt, data):

t = Table(data)

('GRID', (0, 0), (-1, -1), 0.5, colors.grey),
('BOX', (0, 0), (-1, -1), 2, colors.black),

styles = getSampleStyleSheet()

def go():
doc = SimpleDocTemplate("foodservice.pdf")
style = styles["Normal"]

Story = []
Story.append(Paragraph(title, styles['Heading1']))
Story.append(Paragraph(dt.strftime('%A, %B %d, %Y'),

# This draws the table on to the page.

# This renders the doc.


if __name__ == '__main__':

employees = ('Matt Wilson', 'Matt Wilson', 'Matt Wilson')
data = [(emp, '6:00 AM') for emp in employees]

tfun('Food Service Schedule', datetime.now().date(),

Matthew Wilson
matt at tplus1.com

More information about the reportlab-users mailing list