如何使用 Reportlab 垂直对齐表格内的段落?
我正在使用 Reportlab 生成报告卡。 报告卡基本上是一个大的 Table 对象。 表格单元格中的一些内容需要换行,特别是标题和注释,我还需要将某些元素加粗。
为了实现换行和加粗功能,我在表中使用了 Paragraph 对象。 我的表格需要其中几个元素垂直对齐到“中间”,但段落对齐并将我的文本对齐到单元格的底部。
如何在表格单元格内垂直对齐我的段落?
I'm using Reportlab to generate report cards. The report cards are basically one big Table object. Some of the content in the table cells needs to wrap, specifically titles and comments, and I also need to bold certain elements.
To accomplish both the wrapping and ability to bold, I'm using Paragraph objects within the Table. My table needs several of these elements vertically aligned to 'middle' but the Paragraph alignment and snaps my text to the bottom of the cell.
How can I vertically align my Paragraph within a Table cell?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我要问:你尝试过 tablestyle VALIGN:MIDDLE 吗?
类似于:(
更多详细信息请参阅 ReportLab 用户指南第 7.2 节)
如果这不起作用,那么您的段落对象必须是单元格的完整高度,并且在内部与底部对齐。
您能否发布一个重现该问题的小样本?
I have to ask: have you tried the tablestyle VALIGN:MIDDLE?
something like:
(more details in section 7.2 of the ReportLab user guide)
If that doesn't do it, then your paragraph object must be the full height of the cell, and internally aligned to the bottom.
Could you please post a small sample that reproduces the problem?