Home‎ > ‎

ReportLab

AttributeError: FragLine instance has no attribute 'lineBreak'

ref. http://note.harajuku-tech.org/rst2pdfpdf

reportlabのparagraph.py修正

$ vi /home/hdknr/.ve/emirps/lib/python2.5/site-packages/reportlab/platypus/paragraph.py
def _justifyDrawParaLineX( tx, offset, line, last=0):
    setXPos(tx,offset)
    extraSpace = line.extraSpace
#    simple = last or abs(extraSpace)<=1e-8 or line.lineBreak   # HDKNR
    simple = last or abs(extraSpace)<=1e-8 or getattr(line, 'lineBreak', False)
    if not simple:
        nSpaces = line.wordCount+sum([_nbspCount(w.text) for w in line.words if not hasattr(w,'cbDefn')])-1
        simple = not nSpaces
    if not simple:
        tx.setWordSpace(extraSpace / float(nSpaces))
        _putFragLine(offset, tx, line)
        tx.setWordSpace(0)
    else:
        _putFragLine(offset, tx, line)  #no space modification
    setXPos(tx,-offset)

Comments