[reportlab-users] Bug with keep with next and Indenter?

Ilpo Nyyssönen iny+news at iki.fi
Wed Jul 12 02:58:35 EDT 2006


Should this work?

--8<---------------cut here---------------start------------->8---
    normalStyle = styles.ParagraphStyle(name = 'normal')
    keepStyle = styles.ParagraphStyle(name = 'keep', keepWithNext = True)
    content = [
        platypus.Paragraph("line 1", keepStyle),
        platypus.Indenter(left = 1 * units.cm),
        platypus.Paragraph("line 2", normalStyle),
        ]
    doc = platypus.SimpleDocTemplate('proof.pdf')
    doc.build(content)
--8<---------------cut here---------------end--------------->8---

I get this error with ReportLab 2.0:

Traceback (most recent call last):
  File "./proof.py", line 26, in ?
    if __name__ == '__main__': main()
  File "./proof.py", line 24, in main
    doc.build(content)
  File "/usr/lib/python2.4/site-packages/reportlab/platypus/doctemplate.py", line 870, in build
    BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker)
  File "/usr/lib/python2.4/site-packages/reportlab/platypus/doctemplate.py", line 702, in build
    self.handle_flowable(flowables)
  File "/usr/lib/python2.4/site-packages/reportlab/platypus/doctemplate.py", line 617, in handle_flowable
    if self.frame.add(f, self.canv, trySplit=self.allowSplitting):
  File "/usr/lib/python2.4/site-packages/reportlab/platypus/frames.py", line 133, in _add
    w, h = flowable.wrap(aW, h)
  File "/usr/lib/python2.4/site-packages/reportlab/platypus/flowables.py", line 506, in wrap
    W,H = _listWrapOn(self._content,aW,self.canv,dims=dims)
  File "/usr/lib/python2.4/site-packages/reportlab/platypus/flowables.py", line 450, in _listWrapOn
    w,h = f.wrapOn(canv,availWidth,0xfffffff)
  File "/usr/lib/python2.4/site-packages/reportlab/platypus/flowables.py", line 114, in wrapOn
    w, h = self.wrap(aW,aH)
  File "/usr/lib/python2.4/site-packages/reportlab/platypus/flowables.py", line 122, in wrap
    return (self.width, self.height)
AttributeError: Indenter instance has no attribute 'width'

-- 
Ilpo Nyyssönen # biny # /* :-) */



More information about the reportlab-users mailing list