[reportlab-users] AttributeError: XPreformatted instance has no attribute 'blPara'

Adrian Klaver adrian.klaver at gmail.com
Tue Jan 3 13:10:07 EST 2012


On 01/03/2012 09:47 AM, Michael Hipp wrote:

> Sorry for being impatient. Can anyone offer me any thoughts on what to

> do about this? I'm kinda stuck.


It is choking on:
blPara = self.blPara

which is coming from paragraph.py.

Looking at paragraph.py self.blPara is not defined until the wrap()
method of the Paragraph class is called.
In the tests in xpreformatted.py there is this code snippet:
def try_it(text,style,dedent,aW,aH):
P=XPreformatted(text,style,dedent=dedent)
dumpXPreformattedFrags(P)
w,h = P.wrap(aW, aH)
dumpXPreformattedLines(P)
S = P.split(aW,aH)
dumpXPreformattedLines(P)
for s in S:
s.wrap(aW,aH)
dumpXPreformattedLines(s)
aH = 500

You might want to emulate the above by doing:
hdr = "%s\nMemo: %s\nSale date: %s" % \
(self.seller, self.memo, self.sale_date.strftime('%Y-%m-%d'))
ch = XPreformatted(hdr, self.style)
w,h = ch.wrap(aW,aH)
ch.drawOn(canvas, 0.75*inch, ph-1.00*inch)





>

> Michael

>

>



--
Adrian Klaver
adrian.klaver at gmail.com


More information about the reportlab-users mailing list