将 PyQt 中的 QTreeWidge 转换为 ReportLab 中的表
由于报表在 ReportLab 中看起来几乎过于复杂,我试图确定一种方法来简单地添加(如果可能的话,最好通过 Paragraph 类)两个单独的文本,一个位于页面的左侧,另一个位于页面的右侧。尽管我可以上网,但我找不到任何关于如何实现这一目标的解释。那么如果这是可能的,你会怎么做呢?
最后,我想要实现的是将 PyQT 中的 QTreeWidget 中的数据转换为具有相似外观和感觉的 PDF。
提前致谢!
As tables seem almost overly complicated in ReportLab, I'm trying to determine a means to simply add (preferably through the Paragraph class, if possible) two separate texts, one on the left side of the page and the other on the right. As much as I could internet I could find no seeming explanation of how to accomplish this. So if this is possible, how do you do it?
At the end what I'm trying to pull off is converting data from a QTreeWidget in PyQT into a PDF with similar look and feel.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来实现这一点最好通过表格来完成。因此,尽管它很复杂,但学习表数据嵌套列表的结构是正确的方法。转换 QTreeWidget 数据的关键在于下面的代码行,因为您必须在处理表数据时动态附加数据和单元格样式。
假设 QTreeWidget 的组合只是具有两列文本(0 和 1)的项目,则以下内容有效。
It would appear that accomplishing this is best done through Tables. So though it be convoluted, learning the structure of table data nested lists was the way to go. The key for converting QTreeWidget data goes along the lines of the codes below, in that you have to dynamically append both data and cell styling as you work your way through the table data.
Assuming the QTreeWidget's composition is simply items with two columns of text (0, and 1), the below works.