[reportlab-users] Printing Tuples From A List

Andy Robinson andy at reportlab.com
Thu Oct 11 04:10:07 EDT 2007


> I have output. But, it's one string per line. I'd like each tuple on the

> same line, separated by a tab (or arrow dingbat). Where in the doc is that

> explained? I cannot use textobject.textLine(pair) because there's nore than

> one string in the list.

We don't draw "tabs", and nor does any other graphics API I have
worked with.; a string with a tab character in it will just get drawn
with a space or some error character.

To do a tabular report in pdfgen, you would need to explicitly set a y
position for each coumn and write code to move across and down; or use
Courier and build a string
with formatted columns, which is a little bit "1970" in style.

Your best bet is to use Platypus and generate a table. There is
documentation in the user guide, and a script you can adapt in
reportlab/test/test_platypus_tables.py. I suggest you
take that, and modify it so the data array is basically your query
results. It also has some useful features like being able to carry
over to the next page, and repeat title rows when you start a new
page. There is documentation in the user guide on all the ways to
format tables.

- Andy Robinson

Andy Robinson
CEO/Chief Architect
ReportLab Europe Ltd.
165 The Broadway, Wimbledon, London SW19 1NE, UK
Tel +44-20-8544-8049

More information about the reportlab-users mailing list