ReportLab-如果段落对于一行来说太长,如何引入换行符 [英] Reportlab - how to introduce line break if the paragraph is too long for a line
本文介绍了ReportLab-如果段落对于一行来说太长,如何引入换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个要添加到reportlab框架的文本列表
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 legends:
elements.append(Paragraph(str(legend),style))
如果图例太长,则末尾的文本根本看不到. 在这种情况下如何引入换行符.
If the legend is too long, the text at the end is not visible at all. How to introduce line breaks in this situation.
推荐答案
这可能适用也可能不适用,但我刚刚了解到,通常用于在Python字符串中引入新行的\n
被ReportLab的Paragraph对象忽略了.
This may or may not apply but I just learned that \n
which I normally use to introduce new lines in Python strings gets ignored by the Paragraph object of ReportLab.
从邮件列表中,我了解到在段落中,您可以使用HTML的<br/>
来引入新行.
From a mailing list I learned that inside Paragraph you can use HTML's <br/>
to introduce the new line instead.
对我来说很好.
这篇关于ReportLab-如果段落对于一行来说太长,如何引入换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文