首页 > 解决方案 > 如何在reportlab中调整特定单元格的大小

问题描述

我想缩小特定单元格的大小。我尝试了以下代码,但它调整了每一列的大小。

table = Table(data, colWidths=[1.9*inch] * 5)

我也在表中尝试了这段代码style

style = TableStyle([
('colWidths', (3, 3), (3, 3), 0.5*cm )
])

但它不起作用。

如何调整特定单元格的大小,例如单元格编号3,3

标签: pythonreportlab

解决方案


您是否尝试过将列表传递给colWidths和/或rowHeights不同大小的列表?就像是:

table = Table(data, colWidths=[2, 2, 2, 1, 2, 2], 
              rowHeights=[2, 2, 2, 1, 2, 2])

推荐阅读