Reportlab - how to introduce line break if the paragraph is too long for a line

后端 未结 3 620
北海茫月
北海茫月 2020-12-19 02:15

I have a list of text to be added to a reportlab frame

style = getSampleStyleSheet()[\'Normal\']
style.wordWrap = \'LTR\'
style.leading = 12
for legend in le         


        
3条回答
  •  情深已故
    2020-12-19 02:47

    As PolyGeo says, you can use
    to add new lines to a Paragraph.

    Convert new lines to
    tags

    replace('\n','
    \n')

    Updated code

     for legend in legends:
            content = str(legend).replace('\n','
    \n') elements.append(Paragraph(content, style))

提交回复
热议问题