Multiple table footer rows #1678
-
Is it possible to add more than one rows as the footer of a table? Alternatively, is it possible to add line breaks at desired places in each cell's content? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
There's no multiple footers, but you can put line breaks in cells. |
Beta Was this translation helpful? Give feedback.
-
I experimented with the line breaks before, but for some reason it was making stairs as we go from one column to the next. I might have had some issues in my code. I can confirm it works as expected on a sample code. Thanks! from rich.table import Table
from rich.console import Console
table = Table(title="Line breaks in cells", show_header=True, show_footer=True)
table.add_column("First Column", "Foot C1R1\n[dim]Foot C1R2[/dim]")
table.add_column("Second Column", "Foot C2R1\n[dim]Foot C2R2[/dim]", justify="right")
table.add_column("Third Column", "Foot C3R1\n[dim]Foot C3R2[/dim]", justify="right")
table.add_row("Cell C1R1\nCell C1R2", "Cell C2R1\nCell C2R2", "Cell C3R1\nCell C3R2")
table.add_row("Foo", "Bar", "Baz")
console = Console()
console.print(table) Produces:
|
Beta Was this translation helpful? Give feedback.
There's no multiple footers, but you can put line breaks in cells.