[reportlab-users] Width of XPreformatted

Rüdiger Mähl ruediger.maehl at web.de
Mon Jan 9 15:03:21 EST 2012


Hi folks,

I am trying to find a formula to determine the width of an
XPreformatted paragraph, but the returned width is way too small.
I tried these commands:

s30 = '''
owner.object | object type | size [MB]
------------------------------ | ----------- | ---------
SCHEMA1.TAB_NO_INFO | TABLE | 1673.4
SCHEMA1.ALL_EACH_NOW | TABLE | 1050.8
SCHEMA1.INDEX_NEW_FOUND | INDEX | 481.8
SCHEMA1.ITEMS_FOUND | TABLE | 449.0
'''
p30 = XPreformatted(s30, Styles['Code'])

w30 = p30.minWidth()

And then I used the width in w30 as one of the colWidths of a Table.

tab30 = Table(...colWidths=[w30]...)

The resulting column is too small, the width seems to be calculated by
using 'Times' and not 'Courier' and it seems to ignore the blanks.

Is there anything that I am missing?
Is there any other combination of flowables and in-paragraph markup
that I should use preferrably?

Many regards,
Rudi


More information about the reportlab-users mailing list