[reportlab-users] Table autosizing

Andy Robinson andy at reportlab.com
Tue Mar 27 03:48:28 EDT 2007

Remi Cool wrote:

> Hello,


> I generate PDF documents from rml (xml) source. When I use let's say a

> 2 column table, the columns are equally sized at 50% of the available

> width. That's ok for some cases, but doesn't look good when the text in

> the first column is not that wide. Would it be possible to autosize the

> table to the width of the largest text fragment (in the first column) or

> would I need to code such functionality myself?

If you're using Report Markup Language (tm), it does this. You can also
explicitly specify column widths as percentages or fixed amounts.

If you are using Tiny RML, (which is not written by us), then you're on
your own. Sorry.

If using Platypus, the layer of our library which supports RML and (as
far as I know) Tiny RML, I believe it should auto-size. It looks at a
reasonable number of rows at the front, so auto-sizing may not be
perfect for very long tables.

- Andy

More information about the reportlab-users mailing list