[reportlab-users] Width of Preformatted?

Michael Hipp Michael at Hipp.com
Mon Jul 26 11:40:47 EDT 2010


I'm doing something like this:

text = \
"""THE BUSINESS NAME
31 SOME ADDRESS
DENVER, CO 12345
501-123-4567"""
styles = getSampleStyleSheet()
style = styles['Normal']
cell = Preformatted(text, style)

I need to get the actual width that will be taken up by that paragraph. But
when I do:

w,h = cell.wrap(1, 1,)

It gives me something like 1,48. The second number is reasonable for the
height, but why the bogus number for width?

But if I try to do cell.minWidth() it says there's no such animal.

How can I get the width of a Preformatted object?

Thanks,
Michael


More information about the reportlab-users mailing list