Skip to content Skip to sidebar Skip to footer

Reportlab - Add Two Paragraphs Into One Table Cell

I have a table which is build up like the following: styleN = styles['Normal'] data = [] table_row = ['ID', 'Some Information'] data.append(table_row) table_row = [] table_row.ap

Solution 1:

Got feedback in the reportlab google group and it is actually very easy to achieve. Only add a list of paragraphs into the cell.

styleN = styles["Normal"]
data = []
table_row = ['ID', 'Some Information']
data.append(table_row)
table_row = []
table_row.append(Paragraph(object.ID, styleN))
paragraphs = []
info1 = Paragraph(object.some_information1, styleN)
info2 = Paragraph(object.some_information2, styleN)
paragraphs.append(info1)
paragraphs.append(info2)
table_row.append(paragraphs)
data.append(table_row)
t = Table(data, (6*cm,6*cm,2*cm,2*cm,2*cm), None, style=ts)

Post a Comment for "Reportlab - Add Two Paragraphs Into One Table Cell"