[reportlab-users] platypus tables width bug?

Chris Withers chris at simplistix.co.uk
Wed Nov 30 04:42:39 EST 2011


On 30/11/2011 09:05, Andy Robinson wrote:

> On 29 November 2011 21:30, Chris Withers<chris at simplistix.co.uk> wrote:

>> Hi All,

>>

>> Off the back of this, I think I've found a bug:

>>

> Chris, thanks for this.

>

> We are moving to new offices today so don't expect an in-depth answer

> from Robin for a day or two....


In the meantime, I have a work around:

class ScalaingTable(Table):

def __init__(self, data, **kw):
self._scaleWidthPercent = kw.pop('scaleWidth', 100)
Table.__init__(self, data, **kw)

def wrap(self, availWidth, availHeight):
Table.wrap(self, availWidth, availHeight)
if self._width < availWidth and self._scaleWidthPercent:
scale = float(self._scaleWidthPercent)/100
scale_width = scale * availWidth/self._width
self._colpositions = [p*scale_width for p in
self._colpositions]
self._colWidths = [w*scale_width for w in self._colWidths]
self._width = availWidth * scale

return (self._width, self._height)

It'd be great to find the docs for '*', None, and how permutatiopns of
'*', None and numeric column widths are supposed to interact...

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk


More information about the reportlab-users mailing list