我有一个表,其构建如下:
styleN = styles["Normal"]
data = []
table_row = ['ID', 'Some Information']
data.append(table_row)
table_row = []
table_row.append(Paragraph(object.ID, styleN))
table_row.append(Paragraph(object.some_information1, styleN))
data.append(table_row)
t = Table(data, (6*cm,6*cm,2*cm,2*cm,2*cm), row_heights, style=ts)
现在我想实现我可以在第二个单元格中添加包含 object.some_information2 的第二个段落。
一些或多或少的伪代码来说明我想要实现的目标:
table_row = []
table_row.append(Paragraph(object.ID, styleN))
info1 = Paragraph(object.some_information1, styleN)
info2 = Paragraph(object.some_information2, styleN)
info_paragraphs = info1 + info2
table_row.append(info_paragraphs)
data.append(table_row)
t = Table(data, (6*cm,6*cm,2*cm,2*cm,2*cm), row_heights, style=ts)