[reportlab-users] Aligning tablle example
mdriscoll at co.marshall.ia.us
Wed Jul 8 16:42:15 EDT 2009
Andy Robinson wrote:
> 2009/7/8 Mike Driscoll <mdriscoll at co.marshall.ia.us>:
>> I am trying to figure out how to left or right align an entire table.
>> However, the docs only talk about aligning the cells within a table. Can
>> someone tell me how to do this, preferably with some kind of example?
> Tables have a property 'hAlign', in common with many other flowables.
> Sorry it wasn't documented - inside ReportLab we use the RML layer on
> top so tend not to notice.
> There is one example in the test suite, test_platypus_pleaseturnover.py
> - Andy
I tried that, using the following code:
story = 
doc = SimpleDocTemplate('myDoc.pdf', pagesize=(8.5*inch, 11*inch))
data = [['', 'Hours', 'Amount'],
['ct', '24.00', '456.84'],
['h', '16.00', '310.56'],
['r', '32.00', '621.12'],
['v', '8.00', '155.28']]
tbl = Table(data, hAlign=TA_LEFT)
This creates an pdf with the table centered. I take it that there's a
different way to enable this?
More information about the reportlab-users