我试图用Python中的reportlab生成一个发货列表。
我试图通过使用PlatypusFrames
将所有部分(如发送者地址、接收者地址、表)放置到位。在
我遇到的第一个问题是我需要大量的Frames
来正确定位所有东西,有没有更好的方法使用鸭嘴兽?
因为我希望发件人地址和我的地址在同一高度上,如果我只将它们添加到我的story = []
上,它们就会一个比一个对齐。在
下一个问题是我正在绘制的表的大小是动态的,当我到达Frame
(我希望表去的空间)的末尾时,它只执行FrameBreak
并在下一帧中连续。那么如何使Frame
(我的表的空间)是动态的呢?在
您的用例非常常见,因此Reportlab有一个系统可以帮助您解决问题。在
如果您阅读关于
platypus
的用户指南,它将向您介绍4个主要概念:你已经发现了}。这是有意义的,因为对于大多数简单的文档来说,这是不必要的。遗憾的是,发货单不是一个简单的文档,它包含地址、徽标和重要信息,这些信息必须出现在每一页上。这就是
Flowables
和Frames
,但很可能你还没有开始幻想PageTemplates
或{PageTemplates
的作用。在那么如何使用这些模板呢?这个概念很简单,每个页面都有一个特定的结构,在页面之间可能会有所不同,例如在第一页上,您希望输入地址,然后启动表,而在第二页,您只需要表。应该是这样的:
第1页:
第2页:
示例如下:
(如果有Reportlab的文档,这将非常适合于SO文档)
相关问题 更多 >
编程相关推荐