[reportlab-users] platypus para versus flowables

Juha Tuomala Juha.Tuomala at iki.fi
Thu Jan 25 03:22:13 EST 2007





On Tuesday 23 January 2007 20:32, Tim Middleton wrote:

> But then unfortunately led to ....

>

> Module reportlab.platypus.doctemplate, line 726, in build

> Module reportlab.platypus.doctemplate, line 631, in handle_flowable

> Module reportlab.platypus.frames, line 157, in _add

> Module reportlab.platypus.flowables, line 103, in drawOn

> Module reportlab.platypus.flowables, line 88, in _drawOn

> Module reportlab.platypus.para, line 1154, in draw

> TypeError: len() of unsized object

>

> Which i fixed by changing the initialisation of self.lines in

> FastPara.__init__ from None to an empty list.


I think it's not supposed to be like that. If self.lines is
None, it denotes that paragraph has not been wrapped yet and
it should be done (line 1058).

if self.lines is None:
heightused = 0
cursor = 0
nwords = len(words)
done = 0
#heightused = leading # ???
while cursor<nwords and not done:
.
.
.


I'm not sure what are the cases that wrap() is called already
wrapped FastPara, perhaps after split() on page breaks or in
other layout situations. But for me it looks that it cannot
be initialized or the wrapping wont work. (error above, wrap
has been passed without wrapping)

I'm not that well aware of platypus internals, but have been
reading sources to get things work. :-)



My main issue is that tables seem to loose automatic width
logic when cells contain Paragraphs. That casuses them to
expand outside the available A4 paper (the whole table).
With plain text in cells, everything works fine.

I'm using Paragraph in cells beacause of its <b, <i, <a
features (especially the para.py version of Paragraph).


Tuju

--
Ajatteleva ihminen tarvitsee unta.


More information about the reportlab-users mailing list