ReportLab Breakline 不起作用(大文本)
我了解
但它对我不起作用...
我有一行很长的行,所以我必须使用 textwrap 将其包装成更小的行
示例:separate_text = ('
'.join(textwrap.wrap(text, 64)))
1 - 我从数据库中获取了一个大文本(超过 300 个字符)
2 - 我需要插入pdf中的此文本不越过右侧的边框
这是我的代码和我尝试换行的尝试
query = self.cursor.execute("SELECT * FROM Queries WHERE id_query = '"+id_query+"'").fetchall()
listed_queries = []
for i in query:
listed_queries.append(i)
real_listed_queries = list(listed_queries[0])
txt = real_listed_queries[5]
t = ('<br/>'.join(textwrap.wrap(txt, 64)))
c.drawString(50, 355, t)
,我失败的结果是:
I know about <br />
but it's not working for me...
I have a single long line so I had to use textwrap to wrap it into smaller lines
example: separate_text = ('<br/>'.join(textwrap.wrap(text, 64)))
1 - I got a big text from a database ( over than 300 characters )
2 - I need to insert this text in a pdf without go over the border on the right
Here's my code and my attempt to break a line
query = self.cursor.execute("SELECT * FROM Queries WHERE id_query = '"+id_query+"'").fetchall()
listed_queries = []
for i in query:
listed_queries.append(i)
real_listed_queries = list(listed_queries[0])
txt = real_listed_queries[5]
t = ('<br/>'.join(textwrap.wrap(txt, 64)))
c.drawString(50, 355, t)
And my failed result is:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论