Skip to content

Commit

Permalink
Docs and tests for colspan (#807)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Cimon <925560+Lucas-C@users.noreply.github.com>
  • Loading branch information
RubendeBruin and Lucas-C committed Jun 11, 2023
1 parent dffea2f commit e8d6257
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/Tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,38 @@ Result:

![](table_with_gutter.jpg)

## Column span

Cells spanning multiple columns can be defined by passing a `colspan` argument to `.cell()`.
The cells that are overwritten by the spanned cell are not rendered but must be added to the table.

Result:

```python
...
with pdf.table(col_widths=(1, 2, 1,1)) as table:
row = table.row()
row.cell("0")
row.cell("1")
row.cell("2")
row.cell("3")

row = table.row()
row.cell("A1")
row.cell("A2", colspan=2)
row.cell("void") # <--- this cell is not rendered
row.cell("A4")

row = table.row()
row.cell("B1", colspan=2)
row.cell("void") # <--- this cell is not rendered
row.cell("B3")
row.cell("B4")
...
```

![](image-colspan.png)

## Table from pandas DataFrame
_cf._ [Maths documentation page](Maths.md#using-pandas)

Expand Down
Binary file added docs/image-colspan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/table/table_colspan.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions test/table/test_table.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
from pathlib import Path
from subprocess import Popen

import pytest

Expand Down

0 comments on commit e8d6257

Please sign in to comment.