[reportlab-users] Positioning Paragraphs and Tables Precisely

Andy Robinson andy at reportlab.com
Fri Oct 12 17:47:14 EDT 2007

On 12/10/2007, Rich Shepard <rshepard at appl-ecosys.com> wrote:

> I see that a Spacer takes up space, but the definition doesn't tell me the

> units for width and height. Can these be specified explicitly, and use

> negative values?

Currently the width is ignored. We were thinking 'too far ahead' 7
years ago and envisaged it might be used one day when packing boxes

> For example, to move a paragraph close to the top of the page, can I

> .append(Spacer (-1.0*inch, 0))?

Never tried it but it's isn't supposed to do that. It's just to
create extra vertical space between elements, when spaceBefore and
spaceAfter on paragraphs don't give you enough. the packing algorithm
just sees it and moves down.


> What command lets me move a two column table to the left margin? Is this

> also a Spacer()?

Tables are centered by default but have an hAlign attribute to control
their overall position (assuming they are narrower than the enclosing
frame). e.g.

from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT
t = Table(...., hAlign=TA_LEFT)

You can pass it to the constructor, or set it on the table after construction.

Hope this helps
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