如何在reportlab中调整特定单元格的大小

问题描述

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

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

我还在表style中尝试了此代码

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

但它不起作用。

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

解决方法

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

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