Skip to content

How to add a row line with footer #27

@bagualing

Description

@bagualing

Hi, How can I add a row line on the top of footer?

func main() {
	t := table.New(os.Stdout)
	t.SetDividers(table.ASCIIDividers)
	t.SetRowLines(false)
	t.SetHeaders("ID", "Fruit", "Stock")
	t.AddRow("1", "Apple", "14")
	t.AddRow("2", "Banana", "88,041")
	t.AddRow("3", "Cherry", "342")
	t.AddRow("4", "Dragonfruit", "1")
	t.AddFooters("", "Count", "4")
	t.Render()
}

Output

+----+-------------+--------+
| ID |    Fruit    | Stock  |
+----+-------------+--------+
| 1  | Apple       | 14     |
| 2  | Banana      | 88,041 |
| 3  | Cherry      | 342    |
| 4  | Dragonfruit | 1      |
|    |    Count    |   4    |
+----+-------------+--------+

Which I need:

+----+-------------+--------+
| ID |    Fruit    | Stock  |
+----+-------------+--------+
| 1  | Apple       | 14     |
| 2  | Banana      | 88,041 |
| 3  | Cherry      | 342    |
| 4  | Dragonfruit | 1      |
+----+-------------+--------+
|    |    Count    |   4    |
+----+-------------+--------+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions