Python Reportlab
Python Reportlab
pdf_filename = "wrapped_table_example.pdf"
data = [
styles = getSampleStyleSheet()
wrapped_data = []
wrapped_data.append(wrapped_row)
# Define the column widths
col_widths = [100, 50, 300] # Set the width for each column
style = TableStyle([
('BACKGROUND', (0, 0), (-1, 0), colors.grey), # Background color for the
header row
('TEXTCOLOR', (0, 0), (-1, 0), colors.whitesmoke), # Text color for the
header row
('ALIGN', (0, 0), (-1, -1), 'CENTER'), # Align all cells to the center
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'), # Font for the header row
('BOTTOMPADDING', (0, 0), (-1, 0), 12), # Padding for the header row
('GRID', (0, 0), (-1, -1), 1, colors.black) # Add a grid with black lines
])
table.setStyle(style)
elements = [table]
pdf.build(elements)