forked from reingart/pyfpdf
-
Couldn't load subscription status.
- Fork 317
Open
Description
Please explain your intent
It is common to encounter merged cells in a table. Currently, you need to manually create a merged cell using colspan in row.cell(). It would be helpful if merged cells could be handled automatically, eliminating the need to loop over your data and add multiple nested if-else conditions.
Describe the solution you'd like
Assuming our table data appears as follows.
table_data = [
['0', '1', '2', '3'],
['A1', 'A2', '-', 'A4'],
['B1', '-', 'B3', 'B4'],
]Here, we use '-' (or any other user-defined placeholder) to indicate an empty cell.
- Empty cells can be merged with the cell before:
with pdf.table(width=120, auto_merging='before', empty_cell='-') as table- Or they can be merged with the cell after:
with pdf.table(width=120, auto_merging='after', empty_cell='-') as table
